I have a balanced panel dataset with a few dozen weather stations' hourly temperature readings across several decades. I have a measure of population density around the weather station over time as well as the latitude and altitude of the weather station (which remain fixed). I have been tasked with estimating the average effects of population density on temperatures and the average effect of time, hoping to disentangle the urban heat island effect from overall climate change.
I can put all observations into a linear model in R quite easily, controlling for altitude and latitude, but I know this violates the regression assumption of independence. Weather across stations is highly correlated at any given time, and any given observation is highly dependent on the previous hour at that station. I know that there may be unobserved heterogeneity between stations not explained by latitude and altitude, but fixed effects might bias my coefficient on population density because cities change slowly over time. It has been several years since I took an econometrics course (in STATA), so I am stuck knowing that something is wrong but not understanding the correct way to estimate the effect of population density and year.
I have tried the plm package in R, but the arguments are a bit overwhelming, and I am having trouble finding documentation or examples of a similar problem written to my knowledge level. Thank you!