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

The variables are x=SP500 market monthly log return and y = monthly return of Ap

ID: 3353439 • Letter: T

Question

The variables are x=SP500 market monthly log return and y = monthly return of Apple for 48 months beginning in January 2010.
For input into R, the data vectors for monthly market return and monthly stock return are
x=c(-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, 0.049198, 0.011, 0.035355, 0.017924, 0.02055, -0.015113, 0.048278, -0.031798, 0.029316, 0.04363, 0.027663, 0.02329)
and
y=c(-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, -0.155568, -0.02563, 0.002789, 0.000328, 0.022193, -0.126007, 0.132236, 0.080422, -0.021832, 0.092029, 0.067769, 0.008792)

Suppose we want to get a prediction interval for each of the next 10 months (beginning January 2014; when the SP500 returns are values in the following R vector.
xnext=c(-0.036231, 0.042213, 0.006908, 0.006182, 0.020812, 0.018879, -0.015195, 0.036964, -0.015635, 0.022936)

Using the fitted regression equation for January 2010 to December 2013, the lower endpoint of the 95% prediction interval for January 2014 (SP500 return -0.036231) is________The upper endpoint of this 95% prediction interval is___________

The lower endpoint of the 95% prediction interval for October 2014 (SP500 return 0.022936) is____The upper endpoint of this 95% prediction interval is______

anyone can use R to solve these?

Explanation / Answer

Answer:

Using the fitted regression equation for January 2010 to December 2013, the lower endpoint of the 95% prediction interval for January 2014 (SP500 return -0.036231) is -2.405568   The upper endpoint of this 95% prediction interval is 2.914179.

The lower endpoint of the 95% prediction interval for October 2014 (SP500 return 0.022936) is -2.391706 The upper endpoint of this 95% prediction interval is 2.908536.

anyone can use R to solve these?

R code:

x=c(-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, 0.049198, 0.011, 0.035355, 0.017924, 0.02055, -0.015113, 0.048278, -0.031798, 0.029316, 0.04363, 0.027663, 0.02329)

y=c(-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, -0.155568, -0.02563, 0.002789, 0.000328, 0.022193, -0.126007, 0.132236, 0.080422, -0.021832, 0.092029, 0.067769, 0.008792)

xnext=c(-0.036231, 0.042213, 0.006908, 0.006182, 0.020812, 0.018879, -0.015195, 0.036964, -0.015635, 0.022936)

lmfit <-lm(y~x, data = mydata)

summary(lmfit)

anova(lmfit)

confint(lmfit)

newdata = data.frame(x=xnext)

predict(lmfit, newdata, interval='prediction')

R output:

Call:

lm(formula = y ~ x, data = mydata)

Residuals:

     Min       1Q   Median       3Q      Max

-1.28357 -0.38797 -0.08465 0.56961 1.21698

Coefficients:

            Estimate Std. Error t value Pr(>|t|)

(Intercept) 0.25682    0.71339   0.360    0.728

x            0.06946    0.12572   0.552    0.596

Residual standard error: 0.9031 on 8 degrees of freedom

Multiple R-squared: 0.03675,   Adjusted R-squared: -0.08365

F-statistic: 0.3052 on 1 and 8 DF, p-value: 0.5957

> anova(lmfit)

Analysis of Variance Table

Response: y

          Df Sum Sq Mean Sq F value Pr(>F)

x          1 0.2489 0.24894 0.3052 0.5957

Residuals 8 6.5244 0.81555              

> confint(lmfit)

                 2.5 %    97.5 %

(Intercept) -1.3882669 1.9019103

x           -0.2204514 0.3593661

> newdata = data.frame(x=xnext)

> predict(lmfit, newdata, interval='prediction')

         fit       lwr      upr

1 0.2543052 -2.405568 2.914179

2 0.2597537 -2.387206 2.906714

3 0.2573015 -2.395454 2.910057

4 0.2572511 -2.395624 2.910126

5 0.2582673 -2.392203 2.908737

6 0.2581330 -2.392655 2.908921

7 0.2557663 -2.400631 2.912164

8 0.2593891 -2.388431 2.907209

9 0.2557357 -2.400734 2.912206

10 0.2584148 -2.391706 2.908536