I'm taking a course on Supervised Learning in R: Regression. There is a section where I'm supposed to predict blood pressure given age and weight. This is was MY approach
# Create the formula and print it
fmla <- lm(blood_pressure ~ age + weight, data=bloodpressure)
fmla
# Fit the model: bloodpressure_model
bloodpressure_model <- fmla
# Print bloodpressure_model and call summary()
bloodpressure_model
summary(bloodpressure_model)
It was an incorrect submission. The message error message read - "The contents of the variable fmla
aren't correct."
DataCamp's solution was this
# bloodpressure is in the workspace
summary(bloodpressure)
# Create the formula and print it
fmla <- blood_pressure ~ age + weight
fmla <- lm(blood_pressure ~ age + weight, data=bloodpressure)
fmla
# Fit the model: bloodpressure_model
bloodpressure_model <- lm(fmla, data = bloodpressure)
# Print bloodpressure_model and call summary()
bloodpressure_model
summary(bloodpressure_model)
Both of these models had the same diagnostic results. What's the issue with MY approach?