Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In the following R code where the dataset Fin has the variables SPY, X1, X2, X3 which of the following commands would generate the proper
In the following R code where the dataset Fin has the variables SPY, X1, X2, X3 which of the following commands would generate the proper mean squared error for the test sample:
attach(Fin) SubData=data.frame(SPY, X1, X2, X3) len=dim(Fin)[1] train=sample(len,*.7,replace=FALSE) full=lm(Y~.,data=SubData)
A) mean((Fin$SPY-predict(full,Fin))[-train]^2)
B) mean((Fin$SPY-predict(full,Fin))^2)
C) None of the other options
D) mean((Fin$SPY-predict(full,Fin))[train]^2)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started