IQSS / Zelig

A statistical framework that serves as a common interface to a large range of models
http://zeligproject.org
109 stars 43 forks source link

normal.gee with Amelia imputed data #263

Closed christophergandrud closed 7 years ago

christophergandrud commented 7 years ago

From Fernando Bizzarro:

library(Zelig)
load('~/Desktop/geeIssue//low.imput.RData')

# Within Imputs
z1 <- zelig(low_volatility ~ psi_low, data = low.imput$imputations[[1]],
      model = 'normal.gee', corstr = 'AR-M', id = 'country_id')

estimates the model.

The following does not:

# Across
z2 <- zelig(low_volatility ~ psi_low, data = low.imput, model = 'normal.gee',
      corstr = 'AR-M', id = 'country_id')

instead returning:

Error in model.frame.default(formula = low_volatility ~ psi_low, data = as.data.frame(.),  : 
  variable lengths differ (found for '(id)') 
christophergandrud commented 7 years ago

It appears that geeglm accepts as its id argument a vector the same length as the estimation data frame. With MI data it must be using the column for all of the combined MI data set.

christophergandrud commented 7 years ago

Resolved. estimation, setx, and sim work.

Though combine_coef_se returns:

Error in match.arg(type) : 
  'arg' should be one of “pearson”, “working”, “response”
christophergandrud commented 7 years ago

Use naive vcov matrix as indicated in: https://stats.stackexchange.com/a/20440

christophergandrud commented 7 years ago

Should be resolved in d4f5f7d3dfab03557f8d4fa246d91f03226db682