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

MAT 3375 Regression Analysis Questions

1.   (a)  Let Ui  ∼ χ2 (ri) be independent random variables with r1  = 5, r2  = 10.  Set

X = U2(U1)/(/)r2(r1) .

Using R, find s and t such that

P(X ≤ s) = 0.95   and   P(X ≤ t) = 0.99.

(b) Let Z ∼ N(0, 1) and U ∼ χ2 (10) be two independent random variables. Let

Z

V = .

^U/10

Using R, find w such that P(V ≤ w) = 0.95.

2. Let f : Rn  → R, v ∈ Rn , and a ∈ R.  Define f(Y) = Yv + a.  Find the gradient of f with respect to Y. Write a function in R that computes f(Y) given v,a.  Evaluate the function at Y = (1, 0, −1), for v = (1, 2, −3) and a = −2.

Note: in the course, we will write vectors either as columns format or as rows, in a more or less arbitrary way. It is up to you to determine which one makes the dimensions compatible.

3. Let A = (0(1)   1(1) 1), μ = (1, 0, 1), Σ = 1 1 , and Y N(μ, Σ).

Let W = AY. What distribution does the random vector W follow?  Draw a sample of size 100 for this random vector with R and plot them in a graph. Note: you may use the function mvrnorm() from the MASS package to help along (but you do not have to).

4. Let Y N(0, 9I4) and set Y = 4/1 (Y1 + Y2 + Y3 + Y4). Using R, draw 1000 observations from:

(a)  Y12 + Y22 + Y32 + Y42

(b) 4Y

(c)  (Y1 Y)2 + (Y2 Y)2 + (Y3 Y)2 + (Y4 Y)2

In each case, plot a histogram of the observations.

5.  Consider the function f : R3  → R defined by

f(Y) = Y12 Y22 Y32  − Y1Y2 + Y1+ 2Y2 − 3Y3 − 2.

Using R, find the critical point(s) of f. If it is unique, does it give rise to a global maximum of f? A global minimum? A saddle point?

6.   (a) Identify the response variable Y and the predictor variable X in each of the examples shown on slides 4 and 5 of the course notes (Chapter 2).  Is there a linear relationship between X and Y. Draw the approximate line of linear fit (and give its equation).

Hint: use screenshots and software (Paint, PowerPoint, GIMP, etc.) to overlay the line.

(b)  Consider the 4 examples shown on page 9 of the course notes (chapter 2).  Is the variance of the error terms constant? Are the error terms independent of each other?

7.  Consider the dataset Autos.xlsx found on Brightspace.  The predictor variable is VKM.q (X , the average daily distance driven, in km); the response variable is CC.q (Y , the average daily fuel consumption, in L). Use R to:

(a) display the scatterplot of Y versus X;

(b) determine the number of observations n in the dataset;

(c) compute the quantities Σ Xi , Σ Yi , Σ Xi(2) , Σ XiYi , Σ Yi2 ;

(d) find the normal equations of the line of best fit;

(e) find the coefficients of the line of best fit (without using lm()), and

(f) overlay the line of best fit onto the scatterplot.

8.  (continuation of the previous question) Use the R function lm() to obtain the coefficients of the line of best fit and the residuals.  Show (by calculating the required quantities directly) that the first 5 properties of residuals (p. 25 in the course notes of Chapter 2) are satisfied.

9.  (continuation of the previous question) Using R, compute the Pearson and Spearman corre- lation coefficients between the predictor and the response.  Is there a strong or weak linear association between these two variables?  Use the correlation values and diagrams to justify your answer.

10.  (continuation of the previous question) Using R, find the decomposition into sums of squares for the regression.

11.  (continuation of the previous question) Using R, randomly draw n pairs of observations from the data set.  Determine the least squares line of best fit  Ln  and calculate its coefficient of determination Rn(2). Repeat for n = 10, 50, 100, 500 and for all observations. Is there anything

interesting to report? If so, how is it explained?

12.  Using R, plot the residuals corresponding to the ls line of best fit when using all observations in the set. Visually, do the SLR assumptions on the error terms appear to be satisfied? Give a visual approximation of σ2. Then compute the estimator 2.  Compare.

13.  Using R, compute directly the 95% and the 99% confidence interval of the slope of the regres- sion line.

14.  Before even doing the calculations with R, do you think we should be able to determine whether the confidence interval for the intercept of the regression line is smaller or larger than the corresponding interval for the slope? If so, why would this be the case?  Determine directly the 95% and the 99% confidence interval of the intercept.

15.  (continuation of the previous question) Using the fit from the previous questions:

(a)  Test for H0  : β0  = 0 vs. H1  : β0  > 0.

(b)  Test for H0  : β1  = 10 vs. H1  : β1 10.

(c)  Test for H0  : β1  = 0 vs. H1  : β1 0.

Justify and explain your answers.

16.  (continuation of the previous question)

(a)  Using the formulas learned in class, calculate the covariance σ{b0 , b1 }.

(b)  Randomly select a sample of 50 pairs of observations from Autos.xlsx (with or without remplacement, as desired).  Compute the regression parameters (b, b ) corresponding to the sample.  Repeat the procedure 300 times, to produce 300 pairs (bj), b j)).  Display all pairs in a scatter plot.

(c)  Comment on the results. Are they consistent with what you obtained in (a)?

17.  Determine the 95% confidence interval of the expected response E{Y } when the predictor is X = X*.  What is the specific interval when X* = 27?  Calculate the mean of the responses {Y*} when X* = 27 in the data.  Does this mean fall within the confidence interval? Repeat the exercise for X* = 5.  Test H0   : E{Y* | X* = 5} = 0 vs.  H1   : E{Y* | X* = 5} > 0 at confidence level α = 0.05.

18.  Determine the 95% prediction interval for a new response Yp* when the predictor is X = X*. What is the specific interval when X* = 27? What proportion of the responses Yp* fall within the prediction interval when X* = 27?  Repeat the exercise for X* = 5.  Are the results compatible with the notion of prediction interval?   Is the observation  (5 .25) probable  (at α = 0.05)?

19.  (continuation of the previous question)

(a)  Perform a 95% joint estimate of the parameters β0  and β1  Compare with the results of question 16.

(b) Find the joint 95% Working-Hostelling confidence band for the mean response E{Y } when X = X*.  Superimpose the line of best fit and the band on the scatterplot of the observations.

(c)  Find a joint 95% confidence band for the prediction of g  =  20 new responses Yk* at X = Xk(*) , k = 1, . . . , 20. Superimpose the line of best fit and the band on the scatterplot of the observations.

20.  (continuation of the previous question) Perform an analysis of variance to determine if the regression is significant or not.

21.  (continuation of the previous question) Express the SLR Yi  = beta0 + beta1Xi+ varepsiloni using matrix notation. With R, determine the OLS solution directly (without using lm() or

the sums Xi , Yi , Xi(2) , XiYi , Yi2 ).

22.  Consider the dataset Autos.xlsx found on Brightspace.   This  time  around,  we  are only interested in the VPAS vehicles.  The predictor variables are VKM.q (X1, the average daily distance driven, in km) and Age (X2, the age of the vehicle, in years); the response variable is CC.q (Y , the average daily fuel consumption, in L). Use R to:

(a) determine the design matrix X of the SLR model;

(b) compute the fitted values of the response Y if β = (1, 5, 1);

(c)  compute the residual sum of squares if β = (1, 5, 1).

23.  (continuation of the previous question) Determine directly the least squares estimator b of the SLR problem, using matrix manipulations in R. Find the estimated regression function of the response Y.  Compute the residual sum of squares in the case β = b.  Is this value consistent with the result obtained in part (c) of the previous question?

24.  (continuation  of the previous question) Using only matrix manipulations in  R, determine the vector of residuals in the  SLR  problem,  as  well  as  SST,  SSE,  and  SSR.  Verify  that SST = SSR + SSE. What is the mean square error of the SLR model?

25.  (continuation of the previous question) Assuming the SLR model is valid, test whether the regression is significant using the global F test – use R as you see fit (but use it!).

26.  (continuation of the previous question) Find the estimated variance-covariance matrix s2 {b} for the OLS estimator b. At a confidence level of 95%, test for

(a)  H0  : β1  = 0 vs. H1  : β1 0;

(b)  H0  : β2  = 0 vs. H1  : β2  < 0.

27.  (continuation of the previous question) We want to predict the mean response E{Y*} when X* = (20, 5).  What is the fitted value Y(ˆ)* in this case?  Compute a 95% C.I. for the sought quantity.

28.  (continuation of the previous question) We want to predict the new response Yp* when X* = (20, 5). Compute a 95% P.I. for Yp*.

29.  (continuation of the previous question)

(a)  Give joint 95% C.I. for the regression parameters β0 , β1 , and β2 .

(b)  Give joint 95% C.I. for the expected mean value E{Yℓ*} using the Working-Hotelling procedure for X1(*) = (50, 10), X2(*) = (20, 5), X3(*) = (200, 8).

30.  (continuation of the previous question) Is the multiple linear regression model preferable to the two simple linear regression models for the same subset of Autos.xlsx (using X1  or X2 , but not both)? Support your answer.

31.  (continuation of the previous question)  Compute the multiple coefficient of determination and the adjusted multiple coefficient of determination directly (without using lm()).  What do these values tell you about the quality of the fit?

32.  (continuation of the previous question) Is the linearity assumption reasonable?  Justify your answer.

33.  (continuation of the previous question) Is the assumption of constant variance reasonable? Justify your answer.

34.  (continuation of the previous question) Is the assumption of independence of the error terms reasonable? Justify your answer.

35.  (continuation of the previous question) Is the assumption of normality of the error terms reasonable? Justify your answer.

36.  (continuation of the previous question) Overall, do you believe that the multiple linear re- gression model is appropriate? Justify your answer.

37.  (continuation of the previous question) Use appropriate corrective measures to improve the multiple regression results.

38.  (continuation of the previous  question) Are the predictors in the data set multicollinear? Justify your answer.

39.  (continuation of the previous question) For this question, we drop the variable Age from the dataset.  Fit the response to a cubic regression centered on the predictor x1  = X1  − X 1, by adding one variable at a time, to obtain E{Y | x1 } = β0 +β1x1 +β2x1(2) +β3x1(3). Using α = 0.05, test for H0  : β2  = β3  = 0 vs. H1  : β2 0 or β3 0.

40.  (continuation of the previous question) For this question, we re-introduce the variable Age to the data.  Build a polynomial model of degree 2 in X1  and X2  that includes an interaction term (the full model) and a model that is only of degree 1 in X1  and X2, but still contains an interaction term (the reduced model). Determine the coefficients in both cases. Which of the two models is better?

41.  Consider the dataset Autos.xlsx found on Brightspace.  The predictor variable is Type (X , vehicle type); the response is CC.q (Y , average daily fuel consumption, in L). Using a dummy variable encoding, find the regression model of Y as a function of X.  Is this a good model? Justify your answer.

42.  Use the data set provided in the example for Section 4.5.

(a) Find the solution of the WLS problem with wi  = xi(2) , i = 1,...,n. Plot the results.

(b) Find the solution of the WLS problem with the procedure described on p.37.  Plot the results.

(c) Which of the two options gives the best fit? Justify your answer.

43.  Consider the dataset Autos.xlsx found on Brightspace.  The predictor variables are VKM.q (X1, average daily distance, in km), Age (X2, vehicle age in years), and Rural (X3, 0 for urban vehicle, 1 for rural vehicle); the response is still CC.q (Y , average daily fuel consumption, in

L). Use the best subset approach with Mallow’s Cp  criterion to select the best model.

44.  Repeat the previous question, but with the adjusted coefficient of determination Ra(2) .

45.  Repeat the previous question, but with the backward stepwise selection method and with Mallow’s Cp  criterion.

46.  Repeat the previous question, but with the backward stepwise selection method and with the

adjusted coefficient of determination Ra(2) .

47.  Repeat the previous question,  but  with the forward stepwise selection method  and with Mallow’s Cp  criterion.

48.  Repeat the previous question, but with the forward stepwise selection method and with the

adjusted coefficient of determination Ra(2) .

49.  Consider the dataset Autos.xlsx found on Brightspace.  The predictor variables are VKM.q (X1, average daily distance, in km) and Age (X2, vehicle age in years), and Rural (X3, 0 for urban vehicle, 1 for rural vehicle; the response is still CC.q (Y, average daily fuel consumption, in L). Find the X−outliers in the dataset.

50.  (continuation of the previous question) Consider the MLR model ˆ(y) = b0 +b1X1 +b2X2 .  Find the Y −outliers in the dataset.