Hui Jeong(Hailyee) Ha

Human Mobility, Transportation & Spatial Data Science

All Geocomputation lectures

Lecture 6 (2) · Multiple regression

What changes when we hold the rest fixed?

We’ll compare rentals of the same size and see what distance to campus and rental type add to the model.

From the lecture slides

Holding distance fixed in rent comparisons · Slide 12
Holding distance fixed in rent comparisons · Slide 12
Four mall profiles and predictions · Slide 33
Four mall profiles and predictions · Slide 33

We’re back to the same 135 listings. If the slope from Part 1 still feels new, that’s okay. Let’s start with two rentals of the same size and see how the fitted rent changes when we change the distance to campus or the rental type.

Try changing one thing

Start with Slide 12. All three lines keep distance at 3 km. Pick one floor area and compare the fitted rent for Shared, Studio and Apartment. We use the same idea in Slide 33 to compare malls that differ in one feature at a time.

Compare the fits on the same listings

For adjusted R² and AIC, we used the same observations and the same outcome. Then we looked at the residual plot for patterns and at the Q–Q plot for the shape of the residual distribution. VIF helps us see where overlap between predictors makes a coefficient harder to estimate precisely.

In R

Use the Part 2 rental data. Both fits below use the same complete cases.

rent <- read.csv("Data/rentals_part2.csv")
v <- c("rent_cad", "area_m2", "distance_km", "type")
rent <- rent[complete.cases(rent[v]), ]
rent$type <- relevel(factor(rent$type), ref = "Shared")

simple <- lm(rent_cad ~ area_m2, data = rent)
adjusted <- lm(rent_cad ~ area_m2 + distance_km + type,
               data = rent)
AIC(simple, adjusted)
plot(adjusted, which = c(1, 2))

Compare the two area slopes in context. Each slope corresponds to a different set of comparisons.

Key takeaways

  • Say what stayed fixed and which category is the reference.
  • Compare models using the same observations and outcome. Then check the diagnostic plots.