I have a dataset that has multiple observations per county, and I am interested in estimating the effect of a county-level variable on individual-level outcomes. I would like to account for adjacency between counties in this model. I am using errorsarlm() from package spdep. It seems errorsarlm() will only accept data frames that have the same number of rows as the length of the listw object. Since the listw object is the length of the number of unique counties, and the data frame has multiple observations per county, I receive the following error:
Spatial autoregressive error modelError in errorsarlm(ss_form, data = temp, listw = w, method = "eigen", : Input data and neighbourhood list have different dimensionsCan someone please help me figure out a way to fit this model?
I have provided example code below.
#Get spatial polygons data frame from rgeosspdf
Spatial autoregressive error modelError in errorsarlm(ss_form, data = temp, listw = w, method = "eigen", : Input data and neighbourhood list have different dimensionsCan someone please help me figure out a way to fit this model?
I have provided example code below.
#Get spatial polygons data frame from rgeosspdf