MA10212: Computer Lab 3 CJ, Mar 2019For homework: Problem 1Freddy Fisher is planning to spend 5 hours on the river bank catching asmany fish as he can. Let T1 denote the waiting time (in minutes) until hecatches his first fish, T2 the time between catching fish 1 and fish 2, andso forth. We shall assume the Ti, i = 1, 2, . . ., are independent and eachTi ~ Exp(0.1), where 0.1 is the rate parameter.(a) (4 marks) Write code to simulate values T1, . . . , T100, the first 100between-fish intervals. The intention is that there are more than enough Tisto describe what happens in 5 hours of fishing. Check this assumption holdsby finding the sum T1 + . . . + T100 and noting that it is a lot higher than 300(you should get an answer in the range 800 to 1200, or thereabouts).Now find the times X1, X2, . . . , at which fishes are caught (in minutes sinceFreddy started fishing), setting X1 = T1, X2 = T1 + T2, etc. You maywish to start by defining a vector y of length 100 and using the commandy[n]=sum(t[1:n]) to put the sum of the first n elements of the vectort = (T1, . . . , T100) in element n of y. After completing this process, youshould find that some values y[n] exceed 300 — and you need to removethese. Experiment with the commands y constant k to discover a neat way of selecting the elements of y that you wantto retain. Check that your final vector x contains the correct information.(b) (2 marks) Create a function sample.x that simulates one sequenceof the times at which fish are caught. The command x=sample.x() shouldproduce a vector x containing the sequence of fish-catching times. Call yourfunction to check that it produces sensible looking results.(c) (5 marks) Write code to generate 1000 realisations of Freddy’s 5 hourfishing trip. In each case note the total number of fish caught in the five hourperiod and call these numbers N1, . . . , N1000.Madame Cholet insists that the number of fish caught should follow aPoisson distribution. Let μ be the mean of the observed values N1, . . . , N1000.Compare the histogram of your sample of values N1, . . . , N1000 with that ofa sample from a Poisson distribution with mean μ to see if the data agreewith Madame Cholet’s theory.Continue this investigation in an appropriate manner so that you can givea firm conclusion as to whether or not Madame Cholet’s claim is correct.Present appropriate graphical displays to support your argument. (You mayfind it useful to refer back to the methods used in Lab Sheet 2, Problem 2.)3MA10212: Computer Lab 3 CJ, Mar 2019(d) (3 marks) Generate a new sample of 1000 realisations of Freddy’sfish-catching adventure. In each case note W, the time Freddy had to waitbetween the first and second fish that he caught. Put the values of thesewaiting times W in the vector Wsample.What distribution do the data in Wsample appear to follow? Does this agreewith your expectations?(e) (6 marks) Now generate a new sample of 1000 realisations of Freddy’sfish-catching expedition. This time find V , the length of the between-fishinterval that contains the mid-point of Freddy’s 5 hour stay at the river bank.So, if fish are caught at times X1, . . . , XN , you need to find V = Xi+1 ? Xiwhere i is such that Xi 150. (You might experiment withthe commands max(x[xk]) for a specified constant k tofind a neat way to carry out this calculation.) Put the values of these intervallengths V in the vector Vsample.What distribution did you expect the data in Vsample to follow? Is this thecase? Can you find a distribution that fits the data in Vsample?Compare the means of the data in the vectors Wsample and Vsample. Thinkabout how these interval lengths arise and give a plausible explanation forwhy the data in Vsample should be so different from the values in Wsample.(f) (2 marks) You are asked to advise on the design of a study into theprovision of healthcare services. The investigators plan to analyse data froma National Health Service data-base to see how long people have to waitbetween the time their doctor decides they need a hip replacement and thetime the hip replacement operation is performed. The proposal is to extractinformation about their waiting times for all patients who were in the processof waiting for a hip replacement on 1 July 2017.Given what you have observed in the fish-catching example, what commentswould you make to these investigators?Presentation (3 marks)Your submission should be well organized and easy to follow.Tidy up your output by deleting any errors and unnecessary commands.Give each plot a title and label the x and y axes.Answer the questions as stated and use colour to highlight your answers anddistinguish these from output produced directly by R.本团队核心人员组成主要包括硅谷工程师、BAT一线工程师,精通德英语!我们主要业务范围是代做编程大作业、课程设计等等。我们的方向领域:window编程 数值算法 AI人工智能 金融统计 计量分析 大数据 网络编程 WEB编程 通讯编程 游戏编程多媒体linux 外挂编程 程序API图像处理 嵌入式/单片机 数据库编程 控制台 进程与线程 网络安全 汇编语言 硬件编程 软件设计 工程标准规等。其中代写编程、代写程序、代写留学生程序作业语言或工具包括但不限于以下范围:C/C++/C#代写Java代写IT代写Python代写辅导编程作业Matlab代写Haskell代写Processing代写Linux环境搭建Rust代写Data Structure Assginment 数据结构代写MIPS代写Machine Learning 作业 代写Oracle/SQL/PostgreSQL/Pig 数据库代写/代做/辅导Web开发、网站开发、网站作业ASP.NET网站开发Finance Insurace Statistics统计、回归、迭代Prolog代写Computer Computational method代做因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:99515681@qq.com 微信:codehelp
网友评论