lab5 - STAT5044: lab 5 Inyoung Kim Outline 1 How to fit the...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: STAT5044: lab 5 Inyoung Kim Outline 1 How to fit the polynomial regression in R Example The data is an old economic dataset on 50 different countries. These data are averages from 1960 to 1970 (to remove business cycle or short-term fluctuations). dpi is the per capita income in U.S. dollars; ddpi is the percentage rate of change in per capita disposable income; sr is aggregate personal savings divided by disposable income. The percentage of population under 15(pop15) and over75(pop75) is also recored. The data come from Belsley, Kuh, and Welsch (1980). The goal is to study the relationship between sr and ddpi. Fit the simple linear regression > data(savings) > savings sr pop15 pop75 dpi ddpi Australia 11.43 29.35 2.87 2329.68 2.87 Austria 12.07 23.32 4.41 1507.99 3.93 Belgium 13.17 23.80 4.43 2108.47 3.82 . . . Jamaica 7.72 41.12 1.73 380.47 10.23 Uruguay 9.24 28.13 2.72 766.54 1.88 Libya 8.89 43.69 2.07 123.58 16.71 Malaysia 4.71 47.20 0.66 242.69 5.08 Fit simple linear regression > summary(lm(srddpi,savings)) Call: lm(formula = sr ddpi, data = savings) Residuals: Min 1Q Median 3Q Max-8.5535 -3.7349 0.9835 2.7720 9.3104 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 7.8830 1.0110 7.797 4.46e-10 *** ddpi 0.4758 0.2146 2.217 0.0314 *--- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Residual standard error: 4.311 on 48 degrees of freedom Multiple R-Squared: 0.0929, Adjusted R-squared: 0.074 F-statistic: 4.916 on 1 and 48 DF, p-value: 0.03139 The pvalue of ddpi is significant so move on to a quadratic term; Fit quadratic regression > summary(lm(srddpi+I(ddpi2),savings)) Call: lm(formula = sr ddpi + I(ddpi2), data = savings) Residuals:...
View Full Document

Page1 / 14

lab5 - STAT5044: lab 5 Inyoung Kim Outline 1 How to fit the...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online