STAT3023: Statistical Inference Semester 2, 2022
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
STAT3023: Statistical Inference
Semester 2, 2022
1. (a) Generate 100 realisations of the sample variance of 10 independent N(0.1) random variables and store them in s2.
(b) Plot the histogram of (10-1)*s2 and overlay it with the density function of the Ⅹ9(2) distribution (use dchisq).
(c) Repeat (a) and (b) with n = 60 independent N(0.1) random variables. Over- lay the histogram with both the density curve of Ⅹn(2) − 1 and the density curve of N(n _ 1.2(n _ 1)) (in two different colours). Comment on the fit.
(d) For n = 60, compute P ((n _ 1) _ 82 > 68) using both the exact distribution (Ⅹn(2) − 1 ) and the normal approximation. Compare the results.
2. (a) When two random variables (X.y) follow a bivariate normal distribution, the covariance matrix Σ is defined as
Σ = .βσ 1(σ)σ222 、.
where β is the correlation, σ1(2).σ2(2) are the variances of X and y respectively. Use mvrnorm from the MASS library (use library(MASS)) to generate 100 samples from a bivariate normal distribution with μ = (μ1.μ2 ) with μ 1 = 2,
μ2 = 3, and Σ = .1(1) 4(1)、. Call the first column x and the second column y.
(b) Plot the histogram of x and overlay it with the corresponding marginal normal density. Repeat for y. (Recall the marginal distribution of X is N(μ1.σ 1(2)).)
(c) Produce a scatter plot of x and y (use plot). Compute the sample correlation coefficient (use cor) and compare with the population correlation β . (First work out β in the Σ given.)
3. (a) Generate 100 realizations of the uniform U(0.1) distribution and store it in
u. Apply the transformation 2 = _ log u. Verify that 2 is a sample from an exponential(1) distribution by plot the histogram of 2 and overlay it with the density of the distribution.
(b) Generate 100 realisations of the minimum of 10 independent exponential(1) random variables. Note the rate parameter in rexp is defined as the reciprocal of the expectation (check the density function in the help file ?rexp).
(c) Plot the histogram and overlay it with the density of exponential(1/10) (rate=10) distribution. Comment on the fit.
2022-08-17