Question: questions Note that for this question, your answer should include R code that generates the appropriate au swers. Use Rmarlcdoum and submit your .Rmd script

questions


Note that for this question, your answer should include R code that generates the appropriate au swers. Use Rmarlcdoum and submit your .Rmd script {HTML optional) and note there will be penalties for scripts that fail to compile. Please note that you do not need to repeat code for each part (i.e., if you write a single block of code that generates the answers for some or all ofthe parts, that is ne, but do please label your output that answers each questionll). Consider a 'height' type experiment where we can assume X N N01, or?) where the true u = 0.5 and a? = 1 is known to you in this case (obviously in real cases, this will never be known). Assume that you will be generating samples of size n. and that for each sample, the test statistic you will be calculating will be the mean of the sample. For parts [a, c, e, g] you are being asked to provide answers based on the distribution of the test statistic (the mean) for the null hypothesis or the true distribution for the expecliment, where the R functions 'qnorm()' and 'pnorm()' can be used in the calculation of the answers. For parts [b, d, f, h] you are being asked to simulate h = 1000 samples of size 11 (Le, 1000 separate samples) under the null hypothesis or the true distribution for the experiment and for each of the h samples, you are asked to calculate the mean statistic, where the flmction 'rnormO' can be used to generate the samples. For parts [i, j], you are bring asked to calculate the LRT statistic for each of the 1000 samples of size n (i.e., a different statistic!) where each of the l: samples is generated under the null hypothesis or the true distribution. a. Consider Hg : ,u = 0 where you know the true or? = 1 for the purposes of this question (re-ember, not realistic!) Consider a sample size n = 20 and the mean of the sample as the test statistic. What is the critical threshold for this statistic for a Type I error = a = 0.05 when considering H ,4 > 0? What are the two values of the critical threshold for this statistic for a Type I error = o: = 0.05 when considering H ,4 3L 0? HINT: use the function 'qnorm()'. b. Simulate k = 1000 samples under the null hypothesis in part [a], calculate the mean for each sample, and plot a histogram of the means. NOTE: you do not need to output the samples or the means (H), just the histogram (and provide your code). btw, no answer required, but take a look at how many of your sample statistics are beyond the critical thresholds you calculated in part [a]... c. Consider the true distribution of the experiment ,u = 0.5, o2 = 1 for the purposes of this question (again, not realistic!). Consider a sample size n = 20 and the mean of the sample as the test statistic. What is the power of this test for the null hypothesis in part [a] with a Type I error = o: = 0.05 when considering HA } 0'? What is the power of this test for the null hypothesis in part [a] with a Type I error = o: = 0.05 when considering H ,4 7L 0? HINT: use the function 'pnorm()' and your critical thresholds from part [a]. d. Simulate h = 1000 samples under the true distribution (as used in part [c]), calculate the mean for each sample, and plot a histogram of the means. NOTE: you do not need to output the samples or the means (ll), just the histogram (and provide your code). btw, no answer required, but take a look at how many of your sample statistics are beyond the critical thresholds you calculated in part [a] and see how this compares to the power you calculated in part [c]... e. Repeat part [a] but consider n = 100. f. Repeat part [b] but consider n = 100. g. Repeat part [c] but consider n = 100. h. Repeat part [d] but consider it = 100. . Repeat part [a] but consider n = 100. . Repeat part [b] but consider a = ll]. . Repeat part [C] but consider n = 100. . Repeat part [d] but consider a = ll]. '. For the samples you generated in parts [b] and [f] calculate the LET = 2In% statistic for in E (00, co) and plot a histogram of these statistics. NOTE: you do not need to output the samples or each LRT (1!), just the two histograms (and provide your code). btw, no answer required, but see if you can gure out what distribution these histograms look like and consider whether these are different (and see if you can gure out why?). '. For the samples you generated in parts [d] and [h] calculate the LRT = 2Ing%% statistic for in E (00, co) and plot a histogram of these statistics. NOTE: you do not need to output the samples or each LRT (1!), just the two histograms (and provide your code). btw, no answer required, but notice Whether these are different than the distributions you calculated in part [i] and Whether they differ from each other (and see if you gure out why?)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
