Suppose you want to create a model where "parking duration" depends on "building area", "number of floors" as well as "height". How do you do that in R?
We use the same lm() function but this time the formula is as follows
model <- lm(parking_duration ~ building_area + number_of_floors + height)
If we find summary of our model using following
summary(model)
The output is as follows
Call:
lm(formula = parking_duration ~ building_area + number_of_floors +
height)
Residuals:
Min 1Q Median 3Q Max
-378.02 -190.79 -47.92 219.22 419.39
Coefficients: (1 not defined because of singularities)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1708.99539 476.27213 3.588 0.00155 **
building_area -0.03149 0.02297 -1.371 0.18358
number_of_floors -0.12384 4.77416 -0.026 0.97953
height NA NA NA NA
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 234.6 on 23 degrees of freedom
Multiple R-squared: 0.08213, Adjusted R-squared: 0.002317
F-statistic: 1.029 on 2 and 23 DF, p-value: 0.3732
We can see that none of the coefficients are statistically significant.