Here are some notes and explanations for the script code that you have just run:
- lm() function: This function runs a simple linear regression using the lm() function. This function predicts women's height based upon the value of their weight. In statistical parlance, you will be regressing height on weight. The line of code which accomplishes this is:
lm_output <- lm(women$height ~ women$weight)
- There are two operations that you will become very familiar with when running predictive models in R:
- The ~ operator: Also called the tilde, this is a shorthand way for separating what you want to predict, with what you are using to predict. This is an expression in formula syntax. What you are predicting (the dependent or target ...