jmpsteen / medflex

Flexible mediation analysis using natural effect models in R
23 stars 6 forks source link

neEffdecomp error for population-average natural effect models #7

Closed jmpsteen closed 7 years ago

jmpsteen commented 7 years ago

neEffdecomp gives error

Error in varterms[sapply(cov, grep, varterms)] : 
  invalid subscript type 'list'

when trying to fit a population-average natural effect model, e.g. using the code below

weightData <- neWeight(negaff ~ att + gender + educ + age, data = UPBdata)
expFit <- glm(att ~ gender + educ + age, data = UPBdata)

weightFit2b <- neModel(UPB ~ att0 * att1, family = binomial,expData = weightData, se = "r", xFit = expFit)
neEffdecomp(weightFit2b)