Sitemap

Week 8, Day 4: Getting the Regressions Right :)

2 min readJul 18, 2025

--

#myInternshipJournaling

Get Aziza Altyyeva’s stories in your inbox

Join Medium for free to get updates from this writer.

Today was a total roller coaster with R, but it ended up being awesome. The main goal was to finally get the DiD regressions running to see what was really going on with land prices. I started by translating the first, simpler model into FEOLS (fixed effects of ordinary least squares), hit run, and immediately got a result that made no sense. It was just this massive wall of text, with hundreds of coefficients for the Acres variable. I was so confused, just staring at the screen, thinking I had completely messed something up. It was super frustrating, but after digging in, it turned out to be such a simple fix. R was treating Acres as a category instead of a number. One quick as.numeric() command and boom, the output was clean. It’s crazy how one little data type can cause so much chaos, but figuring that out felt like the first win of the day, hehe 🙂

new_did_model <- feols(log_per_acre ~ log_sf_dist * is_post_period + log_grid_dist * is_post_period + Acres + composite_flatness_score + dist_road_miles + dist_water_miles + dist_urban_miles | year + LOCALITY + land_cover_code, data = final_va_mod_parcels)

Once that was fixed, I could finally look at the actual results. The first simple model was honestly a bit of a letdown. The main did_variable had a coefficient of -0.0186, but the p-value was 0.84, which is huge. So, no statistically significant effect there; just a big “meh.” That’s when I moved on to the more complex model Dr. Cary suggested, the one from the equation above that uses interaction terms. This model was way more interesting because it asked a smarter question. Instead of just “is there an effect?”, it asked “how does the effect change with distance?”. The first interaction, log_sf_dist:is_post_period, was also insignificant with a p-value of 0.51, so no direct effect from the solar facility’s location. But then I saw the result for the other interaction, is_post_period:log_grid_dist. It had a coefficient of -0.139 and a p-value of 0.054. That was the “aha!” moment. A p-value that is close to 0.05 is marginally significant and definitely means something is going on. It suggests that after the solar farms went in, being close to the power grid became more valuable. It’s just cool to go from having a total dud of a result to finding something unexpected like that. Makes all the earlier headaches feel worth it. Yeah, good end to the day.

--

--