Question

The variables are x=SP500 market monthly log return and y = monthly return of Yahoo for 48 months beginning in January 2008. For input into R, the data vectors for monthly market return and monthly stock return are x=c(-0.0631 14.-0.03538,-0.005977, 0.046451. 0.01 061 8,-0.089884,-0009908, 0.012 117,-0.095181,-0. 185636,-0.077798, 0.007791.-0.08955,-0.1 16457, 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) and y c(-0.192867, 0.370448, 0.040563, -0.053971, -0.024, -0.258709, -0.037982, -0.025975. -0.113535, -0.2997, -0.10779, 0.05822, -0.039286, 0.120337, -0.032261, 0.109334, 0.102978 -0.011429, -0.089453, 0.020049, 0.198054, -0.113441, -0.060271, 0.11414, -0.111471, 0.01979, 0.076671, 0, -0.074713, -0.102901, 0.002886, -0.057074, 0.077752, 0.151627, -0.041479, 0.049933, -0.031148, 0.017221, 0.016929, 0.059354, -0.067179, -0.095673, -0.138101, 0.038193, -0.032863, 0.17189, 0.004466, 0.026383) For the questions below, use 3 decimal places. Part a) The coefficients of the least square regression line are 0- pi Part b) Suppose we want to get a prediction interval for each of the next 10 months (beginning January 2012; when the SP500 returns are values in the following R vector xnextsc(0.04266, 0.039787, 0.030852,一0.007526,-0.064699, 0.038793, 0.012519, 0.019571, 0.023947,-0019988) The t critical value for the 95% prediction interval is Using the fitted regression equation for January 2008 to December 2011 . the lower endpoint of the 95% prediction interval for January 2012 (SP500 return 0.04266) is The upper endpoint of this 95% prediction interval is The lower endpoint of the 95% prediction interval for October 2012 (SP500 return-0.019988) is The upper endpoint of this 95% prediction interval is Part c) Get the 10 prediction intervals for January to October 2012 from part (b) of which you were asked to enter two intervals. The actual values of the monthly stock returns for Yahoo are in the following vector ynext=c(-0.041778,-0.042251. 0.025958, 0.020807,-0.01 9494, 0.037983, 0.000632,-0.078098, 0.086898, 0.052419) 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.)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The dataset is not posted in the tabular format , hence i am going to generate some random dataset , but the r code would still remain the same with the only change being the datapoints

The r snippet is as follows

set.seed(1234)
x<- runif(n=48,min=-0.00001,max=0.01)
y<- runif(n=48,min=-0.00001,max=0.01)

df<- data.frame(cbind(x,y))

# fit the model
fit<- lm(y~x,data=df)

# see the summary stats
summary(fit)

# load the data for the next 10 months
xnext <- as.data.frame(runif(n=10,min=-0.00001,max=0.01))

# get the prediction interval

p<-predict(fit, xnext, interval="prediction")

p<- as.data.frame(p)
# y next

ynext <- as.data.frame(runif(n=10,min=-0.00001,max=0.01))
p<- p[1:10,]

p<- cbind(p,ynext)

colnames(p)[4] <- c("ynext")

p$range <- p$upr-p$lwr

p.in.range <- ifelse(p$ynext<=p$upr & p$ynext<=p$lwr,1,0 )
sum(p.in.range)

The resutls are

> summary(fit)

Call:
lm(formula = y ~ x)

Residuals:
Min 1Q Median 3Q Max
-0.004276 -0.002575 -0.000738 0.002701 0.005238

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.0038100 0.0008767 4.346 7.59e-05 ***
x 0.0708689 0.1636809 0.433 0.667
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.002964 on 46 degrees of freedom
Multiple R-squared: 0.004059,   Adjusted R-squared: -0.01759
F-statistic: 0.1875 on 1 and 46 DF, p-value: 0.6671

Based on the results the regrtession equation is Y = 0.0038 + 0.07*x , which are Beta0 and Beta1 for you

Please note that this is on simulated data , however you just need to change the datasources to see the relevant results

a simple snapshot of the dataframe would be as follows

Iwr rangep.in.range it 0.003889968 -0.002250835 0.01003077 0.0074134179 0.01228161 0 0.004250765 -0.001799271 0.01030080 0.00

Add a comment
Know the answer?
Add Answer to:
The variables are x=SP500 market monthly log return and y = monthly return of Yahoo for...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT