Consider the following data on the number of hours taht 7 persons studied for a French test and their scores on the test
Hours studied (x) | 3 | 9 | 14 | 4 | 3 | 12 | 10 | |||
Test score (y) | 20 | 60 | 80 | 30 | 25 | 70 | 60 |
a) Find the equation of the least squares line that approximates the regression of the test scores on the number of hours studied
b) Predict the average test score of a person who studied 14 hours for the test.
solution:
## R code Hours studied (x) and Test score (y)
x=c(3,9,14,4,3,12,10)
x
y=c(20,60,80,30,25,70,60)
fit=lm(y~x)
summary(fit)
## Answer:
1)
> x=c(3,9,14,4,3,12,10)
> x
[1] 3 9 14 4 3 12 10
> y=c(20,60,80,30,25,70,60)
> fit=lm(y~x)
> summary(fit)
Call:
lm(formula = y ~ x)
Residuals:
1 2 3 4 5 6 7
-3.8140 4.7209 -1.5000 0.9419 1.1860 -1.0116 -0.5233
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.0814 2.3469 3.443 0.0184 *
x 5.2442 0.2636 19.897 5.93e-06 ***
The equation of the least squares line that approximates
the regression
of the test scores on the number of hours studied
2)Average test score of a person who studied 14 hours for
the test
i.e x=14
=81.500
thus,
average test score of a person who studied 14 hours for the test is
81.500
Get Answers For Free
Most questions answered within 1 hours.