代做STA 141A作业、代写Canvas留学生作业、代写R程序设计作业、R实验作业代做帮做Java程序|代做Python程序

STA 141A, Homework 4Due May 28th 2019 (by 8 am)1 Sampling Schemes2 Comparative performance of bootstrap proceduresPlease submit on Canvas, in a compiled R-markdown file (to pdf or html).All code in this assignment should be cleanly written and well commented, with appropriate use of functions/arguments. Imagine you are sending this code to your colleagues or supervisors for review—which they can only do if they can understand it. ***1 Sampling SchemesThis problem is designed to emphasize on the effect of sampling strategies on the actual performance of estimators of population parameters.Use the following code to generate a population of 20000 realizations of a variable X, stratified into two sub-populations of 15000 and 5000 measurements, respectively. Provide brief numerical and graphical summaries of the data for each subpopulation. (Notice that the data has the information about which subpopulation each subject belongs to.) ## Data generationN1 = 15000 # population size for straum 1N2 = 5000 # population size for stratum 2N = N1+N2# data generationset.seed(1000)mydata = matrix(0,N,2)mydata[1:N1,1] = 1 # stratum 1mydata[(N1+1):N,1] = 2 # stratum 2mydata[1:N1,2] = rgamma(N1,shape=3,scale=2) # data for stratum 1mydata[(N1+1):N,2] = rgamma(N2,shape=5,scale=5) # data for stratum 2Write an R function that takes the data set and the sample size n as input, and returns the sample mean and sample standard deviation of a sample of size n drawn from the entire population without replacement. That is, the sampling scheme is SRSWOR (Simple Random Sampling Without Replacement).Write an R function that takes the the data set sample sizes n1 and n2 (corresponding to two sub-populations) as input, an returns the sample mean and sample standard deviation of a sample of size n drawn from the entire population, where the samples are drawn by Stratified Sampling. This means, ni samples are drawn without replacement from the i-th subpopulation, i=1,2.Compare the performance of the two sampling schemes (SRSWOR and Stratified Sampling), in terms of estimating the population mean and population standard deviation. For the stratified sampling, choose ni=n(Ni/N), where Ni is the population size for the i-th subpopulation, and n is the total sample size. For each value of n=100,400,1000, report the mean and variance of the estimators for each population parameter, computed by drawing 10000 samples of both types.Based on your results in (4), write a very brief summary comparing the accuracies of SRSWOR versus Stratified Sampling in terms of estimating the parameters.2 Comparative performance of bootstrap proceduresGenerate a random sample of size n=100 following the univariate regression modelYi=?5+2Xi+εiwhere Xi’s are independent Chi-square variables with degrees of freedom 6, and εi’s are i.i.d. N(0,σ2) with σ=1. Fix a random seed to ensure that the results are reproducible.Fit the least squares regression line to the data and obtain the estimate of (β0,β1,σ2).Obtain 95% confidence intervals for β0 and β1 by using the nonparametric bootstrap procedure with 500 bootstrap replicates. Write an R function that accepts the data, the number of bootstrap replicates (default value = 100), and the confidence level (default value = 0.95) as input, and returns the two confidence intervals as output. (Note: Roughly speaking, a nonparametric bootstrap refers to the procedure where one i) draws bootstrap samples from the original samples with replacement, and ii) fits the regression model on the bootstrap samples.)Obtain 95% confidence intervals for β0 and β1 by using the residual-based bootstrap procedure with 500 bootstrap replicates. Write an R function that accepts the data, the number of bootstrap replicates (default value = 100), and the confidence level (default value = 0.95) as input, and returns the two confidence intervals as output. (Note: The residual-based bootstrap only bootstrap the residuals from a fitted model. You can read more about the residual-based bootstrap here.)How do the confidence intervals in (3) and (4) compare with the theoretical confidence intervals for β0 and β1? To compare the accuracy of the confidence intervals, repeat the procedure in steps (1)–(4) 200 times (using different random seeds for data generation for each simulation run) and report the following (for each type of confidence interval), and compare the results to that of the theoretical confidence intervals.Length of the confidence intervalsCoverage probability, that is,the fraction of simulation runs in which the true parameter falls within the confidence intervals本团队核心人员组成主要包括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 或邮箱:[email protected] 微信:codehelp QQ:99515681 或邮箱:[email protected] 微信:codehelp

你可能感兴趣的:(代做STA 141A作业、代写Canvas留学生作业、代写R程序设计作业、R实验作业代做帮做Java程序|代做Python程序)