Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part a) The coefficients of the least square regression line are ,-| 0.030247 -0

ID: 3353412 • Letter: P

Question

Part a) The coefficients of the least square regression line are ,-| 0.030247 -0846197 Part b) Suppose we want to get a prediction interval for each of the next 10 months (beginning January 2013; when the SP500 returns are values in the following R vector. xnext-c(0.049198, 0.011, 0.035355, 0.017924, 0.02055, -0.015113, 0.048278, -0.031798, 0.029316, 0.04363) The t critical value for the 95% prediction interval is 2.262 Using the fitted regression equation for January 2009 to December 2012, the lower endpoint of the 95% prediction interval for January 2013 SP500 return 0.049198) is -0.04728733 The upper endpoint of this 95% prediction interval is 0.1910445 The lower endpoint of the 95% prediction interval for October 2013 (SP500 return 0.04363) is 1-0.05179417 The upper endpoint of this 95% prediction interval is 0.1861281 Part c) Get the 10 prediction intervals for January to October 2013 from part (b) of which you were asked to enter two intervals. The actual values of the monthly stock returns for Apple are in the following vector ynext-c(-0.155568, -0.02563, 0.002789, 0.000328, 0.022193, -0.126007, 0.132236,0.080422, -0.021832, 0.092029) How many of these observed values (not used in the regression equation) are contained in the corresponding prediction intervals. (The response here is an integer between 0 and 10; theoretically it is close to 9.)

Explanation / Answer

1) t-critical value for 95% two-tailed confidence interval is:

2) 8 <-- ANSWER CAN BE GOT BY RUNNING R CODE AS GIVEN BELOW

-- R-code --

## Fitting data into Linear regression model

x=c(-0.08955, -0.116457, 0.081953, 0.089772, 0.051721, 0.000196, 0.071522, 0.033009, 0.0351, -0.01996, 0.055779, 0.017615, -0.037675, 0.028115, 0.057133, 0.014651, -0.085532, -0.055388, 0.066516, -0.048612, 0.083928, 0.036193, -0.002293, 0.063257, 0.022393, 0.031457, -0.001048, 0.028097, -0.013593, -0.018426, -0.021708, -0.058467, -0.074467, 0.102307, -0.005071, 0.008497, 0.04266, 0.039787, 0.030852, -0.007526, -0.064699, 0.038793, 0.012519, 0.019571, 0.023947, -0.019988, 0.002843, 0.007043)
y=c(0.054521, -0.009844, 0.163178, 0.180219, 0.075986, 0.047628, 0.1374, 0.028859, 0.097099, 0.016933, 0.058762, 0.05271, -0.09252, 0.063101, 0.13851, 0.105141, -0.0162, -0.020846, 0.022278, -0.056502, 0.15454, 0.058929, 0.033429, 0.036004, 0.050494, 0.04018, -0.013426, 0.004635, -0.006538, -0.035537, 0.151108, -0.01443, -0.009222, 0.05975, -0.057437, 0.057982, 0.119578, 0.172546, 0.100109, -0.02637, -0.010644, 0.01077, 0.044731, 0.089729, 0.00286, -0.113904, -0.012387, -0.095123)

xnxt = c(0.049198,0.011,0.035355,0.017924,0.02055,-0.015113,0.048278,-0.031798,0.029316,0.04363)

fit = lm(y~x)
summary(fit)

xn = data.frame(x = xnxt)

# final prediction of 10 months
p1 = predict(fit, newdata = xn, interval = "predict")

ynext = c(-0.155568,-0.02563,0.002789,0.000328,0.022193,-0.126007,0.132236,0.080422,-0.021832,0.092029)

newdf = data.frame(p = p1[1:10], lb = p1[11:20], ub = p1[21:30], yn = ynext)

## Actual t-values for next 10 months inside bounds or not?
newdf$final = ifelse(newdf$yn >= newdf$lb, ifelse(newdf$yn <= newdf$ub,1,0),0)

-- R-code --

=> 8 are within bounds [Answer]