Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

STAC67: Regression Analysis

Assignment 1

(Total: 100 points)

Please submit R Markdown le for Q. 1 and Q. 6 along with your submission of the assignment.

Q. 1 (10 pts) This question is to practice R to sample from a Normal distribution. Obtain random samples from a Normal with mean µ = 100, σ = 20 of size n = 100, 1000, 10,000, 100,000.

When you generate a random number, use R code, set.seed(your student number) before the R codes of generating a random number, so that we can replicate the result.

(a)  (5 pts) On a single page (2 rows, 2 columns) give the histograms on the same set of bins, with a normal density superimposed on each. Comment on the approximation accuracy.

(b)  (5 pts) For each sample size, give the mean, standard deviation, and the following percentiles (2.5, 25, 50, 75, 97.5). Compare these with the theoretical values.

Q. 2 (14 pts)   (a)  (4 pts) Prove the following equalities.

(i)  SXX  =     Xi(2)  n2      (ii)  SXY  =     Xi Yi  n

(b)  Suppose that (Y1 , X1 ), . . . , (Yn , Xn ) is a data set to which we fit a simple linear regression. Let βˆ1  be the least squares estimate of the slope with Y and let r be the sample correlation coefficient.

(i)  (5 pts) Show that

βˆ1  = r

where sY  and sX  are the sample standard deviations of Y1 . . . Yn  and X1 . . . Xn  respectively.

(ii)  (5 pts) Show that

βˆ1                 r ^n 2

s.e(βˆ1 ) =  ^1 r2

Q. 3 (16 pts)  (4 pts each) Anastrozole is a drug often used to treat breast cancer patients. One study attempted to see if the effect of Anastrozole is associated with the age of patients.  The response variable Y is the change the levels of cortisol- binding globulin (CBG). and the covariate x is age. The following summary statistics were reported.

n = 26                    Xi  = 1613        Yi  = 281.9

SXX  = 3756.96   SYY  = 465.34   SXY  = 一757.64

(a) Find the least squares estimates of the intercept and slope. (b)  Give the standard errors for your estimates in (a).

(c)  Construct 95% confidence intervals for the true intercept and true slope.

(d) What conclusions would you draw from your results?

Q. 4 (28 pts)  (4 pts each) We t the linear regression model without the intercept, Yi  = β0Xi + ∈i , i = 1, . . . n,

(a)   Find the least square estimator of β0 .

(b)   Denote the estimator by βˆ0  then the estimated model is i  = βˆ0Xi . Let ei  = Yi 一 i . Can you conclude     ei  = 0?

(c) Assume that the error term are independent and identically distributed, N(0, σ2 ) with σ 2  unknown for successive questions (c to f).  Find the Standard Error for the estimator of β0 .

(d) Design a procedure to test

H_  : β0  = 0           H0  : β0   0

(e)  (5 pts) The data is collected for six observations.

i :       1       2      3      4       5       6

Xi  :     7      12     4     14     25     30

Yi  :    128   213   75   250   446   540

Find the maximum likelihood estimator of β0  and evaluate its value.

(f)  Consider another estimator β˜0  =     Derive its mean and variance.

(g) Which estimator has the smaller variance? Why?

Q. 5 (8 pts)  Consider a simple linear regression model

Yi  = β_ + β0Xi + i , for  i = 1, 2,..., n,

where ∈i  ~ N(0, σ2 ) and

βˆ0  =    (Xi  )(Yi  )

is the least squares estimator of β0 . Imagine βˆ0(*)  =     ci Yi  is any other unbi- ased estimator of β0  with ci  being arbitrary constant. Prove that Var(βˆ0 ) ≤ Var(βˆ0(*)).  That is, prove that the least squares estimator of β0  has the mini- mum variance among all other linear unbiased estimators of β0 .

Q. 6 (24 pts)  (4 pts each) For this question, use R Markdown le. The data set,“vote.txt” is posted at Quercus. The data contains the incumbent party’s vote percentage of the two-party vote coded as vote and average personal income growth in the previous years coded as growth.  The political scientist Douglas Hibbs forecasts elections based solely on economical growth.

(a)  Obtain a scatter plot between two variables (make sure which variable goes to y axis), also add the tted linear regression line.

(b) Fit a simple linear regression in R, predicting elections from the economy. Interpret both estimates (βˆ_  and βˆ0 ) in words.

(c) Predict the incumbent party’s vote in 2008 election and based on that, who will won the election between McCain” and Obama”?  (both by hands and in R)

(d) Test whether there is a positive association between incumbent party’s vote share and economical growth.

(e)  Give a 95% confidence interval for the mean incumbent party’s vote share change as economical growth increases in one unit (percent) (both by hands and in R).

(f)  Compute the probability that P (亡βˆ0 β0 > 1).