Professional Documents
Culture Documents
2
2
Call:
lm(formula = yi ~ xi, data = data)
Residuals:
Min 1Q Median 3Q Max
-19.095 -9.404 -1.404 6.268 34.733
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -173.513 125.765 -1.380 0.2010
xi 4.827 1.816 2.658 0.0262 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> # Make predictions for a new set of xi values (third exam scores)
> new_xi <- c(68, 72, 74)
> predicted_y <- predict(model, newdata = data.frame(xi = new_xi))
>
> # Display the predictions
> predictions <- data.frame(xi = new_xi, predicted_y)
> print(predictions)
xi predicted_y
1 68 154.7494
2 72 174.0590
3 74 183.7138
>