Module #10 Assignment
> library(ISwR)
> # Fit the linear model to predict spemax based on other variables
> model <- lm(pemax ~ age + weight + bmp + fev1, data = cystfibr)
> anova_results <- anova(model)
> print(anova_results)
Analysis of Variance Table
Response: pemax
Df Sum Sq Mean Sq F value Pr(>F)
age 1 10098.5 10098.5 18.4385 0.0003538 ***
weight 1 945.2 945.2 1.7258 0.2038195
bmp 1 2379.7 2379.7 4.3450 0.0501483 .
fev1 1 2455.6 2455.6 4.4836 0.0469468 *
Residuals 20 10953.7 547.7
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> summary_results <- summary(model)
> print(summary_results$coefficients)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 179.295719 61.8854992 2.897217 0.008909191
age -3.418055 3.3085843 -1.033087 0.313894581
weight 2.688189 1.1726985 2.292311 0.032866749
bmp -2.065693 0.8198405 -2.519628 0.020360918
fev1 1.088218 0.5139274 2.117454 0.046946799
ANOVA Results Interpretation:
We can determine whether each predictor significantly contributes to the variation in pemax by looking at the ANOVA table. For instance, we can conclude that age has a substantial influence on pemax levels in the dataset if its p-value is low (i.e., less than 0.05).
Regression Coefficients Interpretation:
Intercept: The expected pemax when all predictors are 0 is represented by the intercept. The intercept aids in anchoring the regression model, even though zero might not be a practical value for some variables (such as weight).
Individual Coefficients: We can gather information about the link between the predictor and pemax from the sign and size of each coefficient. A negative coefficient (for example, if age has a negative coefficient) would imply that increases in age are linked to decreases in pemax, whereas a positive coefficient (for example, fev1) would indicate that rises in fev1 are linked to increases in pemax.
Comments
Post a Comment