BUSI 1301 INTRODUCTION TO
BUSINESS (MGMT 105)
HOMEWORK 6 TEXAS A& M
UNIVERSITY
, lOMoAR cPSD| 19857451
The data set Lifecycle Savings has information about the rate of personal savings in different
countries during the 1960s. The data set comes with R. Read help (Life Cycle Savings) for
information about what the columns in the data set are.
1. Out-of-sample validation.
a. Create a linear regression model to predict the savings rate using the four other variables.
Ans. > model<-lm(sr~pop15+pop75+dpi+ddpi, data=LifeCycleSavings)
> model
Call:
lm(formula = sr ~ pop15 + pop75 + dpi + ddpi, data = LifeCycleSavings)
Coefficients:
(Intercept) pop15 pop75 dpi ddpi
28.5660865 -0.4611931 -1.6914977 -0.0003369 0.4096949
b. Print out a summary of the model
Ans. > summary(model)
Call:
lm(formula = sr ~ pop15 + pop75 + dpi + ddpi, data = LifeCycleSavings)
Residuals:
Min 1Q Median 3Q Max
-8.2422 -2.6857 -0.2488 2.4280 9.7509
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 28.5660865 7.3545161 3.884 0.000334 ***
pop15 -0.4611931 0.1446422 -3.189 0.002603 **
pop75 -1.6914977 1.0835989 -1.561 0.125530
dpi -0.0003369 0.0009311 -0.362 0.719173
ddpi 0.4096949 0.1961971 2.088 0.042471 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 3.803 on 45 degrees of freedom
Multiple R-squared: 0.3385, Adjusted R-squared: 0.2797
F-statistic: 5.756 on 4 and 45 DF, p-value: 0.0007904
c. Perform 10-fold cross validation on the model using the CVlm function in the DAAG library.
Ans.
> load("C:/Users/meatr/Downloads/DAAG Datasets and Functions.RData")
> cv<-CVlm(LifeCycleSavings,formula(sr~pop15+pop75+dpi+ddpi),10)
Analysis of Variance Table
Response: sr
Df Sum Sq Mean Sq F value Pr(>F)