STA 2311 Statistical Programming II
STA 2311 Statistical Programming II
Date: 23rd August 2017 STA 2311: Statistical Programming II Time: 2 hours
INSTRUCTIONS: Answer question ONE (COMPULSORY) and any other TWO questions.
price (in thousands) 300 250 400 550 317 389 425 289 389 559
No. bedrooms 3 3 4 5 4 3 6 3 4 5
i. Write the R-code that inputs the data and implement the appropriate commands to perform
linear regression analysis. [4 marks]
ii. Suppose that the linear regression analysis output was obtained from the data above.
Interpret the results. [7 marks]
> summary(lm(homes$Price˜homes$‘No. of bedrooms‘))
Call:
lm(formula = homes$Price ˜ homes$‘No. of bedrooms‘)
Residuals:
Min 1Q Median 3Q Max
-108.00 -53.95 -5.75 59.77 99.10
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 94.40 97.98 0.963 0.3635
homes$‘No. of bedrooms‘ 73.10 23.76 3.076 0.0152 *
---
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
END OF EXAM