BST 701-001: Advanced Statistical ComputingSpring 2019Take-Home Final ExamDue Date: Wednesday June 12, 2019 at 12:00p (NOON) - upload on LearnInstructionsTake-Home Final is to be completed individually. If you have questions, please let me know.I will only answer questions to clarify wording or possible misunderstandings (i.e. I will nottake a look at your code in efforts to debug; therefore, do not send code in your emails).Please submit your code, with comments followed by a # sign, and or as part of an R markdown file, and submit a separate Word or PDF document with code, plots, answers,(appropriately labeled; i.e. Part 1, Question a). NOTE: Do NOT submit results of helpfiles, or str output. I should be able to run your code and not have to manually commentyour output. Also, properly label each Part of the Exam as well as each Question.1 Problem 1 (10 points)a) Simulate 500 datasets with n = 100 paired observations (xi, yi), such thatyi = 1.5 + .6xi + �i (1)where xiis normally distributed with mean=3 and SD=1, and � is normally distrubitedwith mean=0 and SD=.8. Note that this is a simple linear regression model with β0 = 1.5,β1 = .6, and population correlation ρ = .6 . Store your simulation data in a two matricescalled simx and simy (one line per sample).b) The goal is to assess the actual coverage probabilities (probability of containing the truevalue of .6) of 95% confidence intervals for ρ based on the sample Pearson correlationcoefficient r using Fisher’s Z-transform method. The sample correlation coefficient rdoes not have a normal sampling distribution, but a transformation z0 = .5[log(1 + r) log(1r)], where log is the natural logarithm, has an approximately normal distributionwith standard error = 1/√3. Using the standard error and the appropriate criticalvalue (quantile) from the standard normal distribution, a 95% C.I. for zcan be created.To attain a C.I. for ρ, apply the inverse transformation(2)to the upper and lower limits of he C.I. Write a function f.confidence (using the codefrom part (b) above), that takes the collection of samples and the desired confidence levelas inputs. The output should be the percentage of cases in which ρ = .6 lies withinthe confidence interval. What would you expect in theory this value to be? Apply the1same method to create 99% and 90% confidence intervals and report the actual coverageprobabilities.c) Next, using your first simulated sample, create a simple bootstrap confidence interval withB = 10000 resamples. For each resample, compute the untransformed sample correlationcoefficients. Create a histogram for the empirical sampling distribution of r based on yourbootstrap estimates. Compute the upper and lower limits of a 95% confidence intervalfor ρ using your bootstrapped values of of r for each resample.Problem 2 (10 points)For each simulation below you must: begin with an initial seed; comment on every line of the algorithm to describe each action; not make use of the predefined random number generators in R for each distributiondescribed below (unless where noted).a) The Pareto(a, b) distribution has cdf�Develop an algorithm to simulate a random sample of size 1000 from the Pareto(4,2)distribution. Write out the density of X, and create a histogram that displays thisdensity. NOTE: The only random number generator allowed for use in this problem isrunif.b) A discrete random variable X has probability mass function:x 0 1 2 3 4p(x) 0.1 0.1 0.3 0.2 0.3Develop an algorithm to generate a random sample of size 5000 from the distribution of X.NOTE: The only random number generator allowed for use in this problem is runif. Dothe relative sample frequencies agree closely with the theoretical probability distribution?c) The Rayleigh density is as follows: Develop an algorithm to generate random samples of size2000 from a Rayleigh (σ) distribution. Within your algorithm, consider various valuesfor σ using a for-loop. Display the relationship between each σ value considered and therandom samples drawn. NOTE: The only random number generator allowed for use inthis problem is runif.2d) Generate a random sample of size 1000 from the Beta(3,2) distribution by acceptancerejectionmethod. Create a histogram that displays the sample with the Beta(3,2) densitysuperimposed. NOTE: The only random number generator allowed for use in this problemis runif.2 Problem 3 (10 points )For example 9.2 from Suess and Trumbo (presented in lecture 8), modify the prior distributionfor the mean height difference such that the variance of the prior distribution for μ isassumed to be 25.a) Note that the parameters of the prior distribution for θ were selected such that theprior probability that the standard deviation of height differences is between 0.3mm and20mm is approximately 95%. Choose new parameters for the prior on θ such that theprior probability the SD is between .3mm and 50mm is approximately 95%.b) Assuming the sample mean and SD stay the same, evaluate the mean of the posteriordistribution for sample sizes 10, 20, 30,. . . 90, 100. Plot the value of the posterior meanvs the sample size. Plot the width of the 95% posterior interval for μ vs the sample size.c) Explain the results from part b) based on the relationships between the likelihood, priorfor μ, and posterior distribution for μ.3本团队核心人员组成主要包括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 QQ:99515681 或邮箱:99515681@qq.com 微信:codehelp
网友评论