{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Rforch10 - R Material for Chapter 10 > bill.data bill...

This preview shows pages 1–2. Sign up to view the full content.

R Material for Chapter 10 > bill.data bill income persons sqft 1 228 3220 2 1160 2 156 2750 1 1080 ## the data 3 648 3620 2 1720 4 528 3940 1 1840 5 552 4510 3 2240 6 636 3990 4 2190 7 444 2430 1 830 8 144 3070 1 1150 9 744 3750 2 1570 10 1104 4790 5 2660 11 204 2490 1 900 12 420 3600 3 1680 13 876 5370 1 2550 14 840 3180 7 1770 15 876 5910 2 2960 16 276 320 2 1190 17 1236 5920 3 3130 18 372 3520 2 1560 19 276 3720 1 1510 20 450 4840 1 2190 > reg <- lm(bill~persons+sqft) ## the model > summary(reg) Call: lm(formula = bill ~ persons + sqft) Residuals: Min 1Q Median 3Q Max -196.20 -107.63 -59.41 106.15 300.46 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -202.67048 102.66502 -1.974 0.0648 . persons 54.87364 24.05689 2.281 0.0357 * sqft 0.35101 0.05667 6.194 9.81e-06 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 155.3 on 17 degrees of freedom Multiple R-squared: 0.7835, Adjusted R-squared: 0.758 F-statistic: 30.75 on 2 and 17 DF, p-value: 2.250e-06 > res <- residuals(reg) > plot(sqft,res) ## residuals plotted against X2=sqft > fit <- fitted(reg) ## the fitted values > plot(fit,res) ## residuals plotted against the fitted values > reg1 <- lm(bill~persons) ## regression of bill on persons > res1 <- residuals(reg1) ## residuals from that fit > reg2 <- lm(sqft~persons) ## regression of sqft on persons

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 2

Rforch10 - R Material for Chapter 10 > bill.data bill...

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

View Full Document
Ask a homework question - tutors are online