Fixed effects panel data regression


I would have to do following fixed effect regression: Dependent variable is the Sqm price and the control variables would be: Rooms, Construction Year, Floor, Elevator (1/0) and Condition (1-6). I want to regression to get average residua for every postal code area for every year from regressing prices on time dummies and unit chracteristics.

Does anyone know how I should proceed with this?

Many thanks for your help!

Assuming you don't have a large number of values in the Year variable, create a new variable that is as.factor(Year) and include it in the regression. That will give you the fixed effects. Then put the residuals into a tibble (using tidyverse) and use summarise with the .by argument to get the averages you want.

Yes I only have 13 years. I tried following, but it is not giving me sensible results.

model1 <- lm(price ~ rooms + Construction_year + Floor + Elevator + Condition + as.factor(Year))

That looks right. What is it about the results that don't look sensible?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.