Linear Regression 1
medv: median house value
rm: average number of rooms per house
age: average age of houses
lstat: percent of households with low socio-economic status
head(): the first n rows present in the input data frame
names(): access the variables names
lm(): fit a simple linear regression model
in general: lm(y ~ x, data), y = response and x = predictor, data = data set in which these two
variables are kept
in this example: error because R doesn’t find the variables, two solutions see below
lm.fit: gives basic information about the model its output
summary(lm.fit): for more detailed information (p-values, R 2 statistic, F-statistic…)
medv: median house value
rm: average number of rooms per house
age: average age of houses
lstat: percent of households with low socio-economic status
head(): the first n rows present in the input data frame
names(): access the variables names
lm(): fit a simple linear regression model
in general: lm(y ~ x, data), y = response and x = predictor, data = data set in which these two
variables are kept
in this example: error because R doesn’t find the variables, two solutions see below
lm.fit: gives basic information about the model its output
summary(lm.fit): for more detailed information (p-values, R 2 statistic, F-statistic…)