twang r package timeInvariant argument fails to identify variables in formula

20 Views Asked by At

I am trying to use the twang package. Unfortunately the vignette only provides an example on how to use the example wide data, not the long data. Also I can't seem to work the timeInvariant argument and wondering if anybody else has experienced this (version 2.6).

library(twang)
data(iptwExLong)

iptw.Ex <- iptw(
  formula = tx ~ gender + age + use
  , data = iptwExLong$covariates
  , timeInvariant = timeInvariant ~ gender + age
  , timeIndicators = iptwExLong$covariates$time
  , ID = iptwExLong$covariates$ID
  , n.trees = 500
)

Currently returning:

Error in eval(predvars, data, env) : object 'gender' not found
0

There are 0 best solutions below