Question: Answer the following question by showing the R code. Use R to simulate k standard normal random variables of your choices of sample size n.
Answer the following question by showing the R code.


Use R to simulate k standard normal random variables of your choices of sample size n. Let's call them Zi,i-1...k. Show the following: a) Visually show that the i2 has similar distribution as X2 distribution with k degrees of freedom. (hint for R novice) it might be easier to define an n k matrix, where each column is randomly generated by a standard normal distribution, then use the rowSums function to calculate sum of squares. b) Look up the R package fitdistrplus, and use the R function fitdistr to show that ,2 is indeed fitted to a x random variable. Try a range of different n and k, and report your findings. (Note, you may use the BFGS method with an initial value of df - 1 to fit the distribution chi-squared.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
