Module #10 Assignment

 Question #1 

# install.packages("car")

library(car)


# Load the dataset

data("cystfibr")


# Fit the linear regression model

model <- lm(spemax ~ age + weight + bmp + fev1, data = cystfibr)


# Perform ANOVA

anova_result <- anova(model)


# Display regression coefficients

coefficients(model)


# Print ANOVA results

anova_result

Interpretation: 

The interpretation of the results would involve looking at the coefficients for each variable in the model. These coefficients represent the estimated change in the response variable "spemax" for a one-unit change in the corresponding predictor variable while holding other predictors constant. The ANOVA result tests the overall significance of the model.

Question #2

# Load the dataset

data("secher")


# Fit a linear regression model for log-transformed birth weight

model10 <- lm(log(bwt) ~ I(log(ad) + log(bpd)), data = secher)


# Sum of regression coefficients

sum_coefficients <- sum(coefficients(model10)[2:3])


# Display the sum of regression coefficients

sum_coefficients

Interpretation:  

The interpretation states that an increase in both the log of abdominal diameter and the log of biparietal diameter leads to a combined expected increase of approximately 3 units in log-transformed birth weight. The fact that the sum of coefficients is close to 3 suggests that these two variables together have a significant influence on birth weight.

Comments

Popular posts from this blog

Final Project [LIS4317]

Module # 7 assignment (Visual Analytics)

Module # 8 Input/Output, string manipulation and plyr package