Closed BLMoran closed 7 months ago
Hi Ben,
I see a few issues which could be causing the error message:
point
and direction
need to be supplied for covariates of type "truncated normal"
. Appendix C2 in the Patterns paper gives an example of specifying these sub-parameters. (1|site)
term is problematic in the outcome model. What are you looking to do with this term? Note that a GLM (fit via the glm
function) is used for the outcome modelBest, Sean
Thanks Sean,
In reply to your points:
intvars = 'opioid', interventions = list(c(threshold, 0, Inf)),
but I get the error:
Error in interventions[[i]][[j]][[1]] : object of type 'closure' is not subsettable
Thanks,
Ben
Regarding the truncated normal: Glad to hear the issue went away. And yes, that's right; it only supports truncation in one direction (I believe ultimately based on conventions in the truncreg
package). And yes, the 'left' direction is what you are looking for
Regarding the intervention: It looks like you're missing a nested layer in the list. Try list(list(c(threshold, 0, Inf)))
Regarding the hierarchical term: The package only supports GLMs for the outcome model. Heads up though that the CIs around the treatment effects are based on bootstrapping
I'm closing this thread assuming that your questions have been resolved, but of course feel free to reach out if you have any other questions
Hi, I've crossposted this to stackoverflow as well (here).
I'm trying to use the gfoRmula package to determine the effect of a time-varying treatment (
opioid
) on a binary outcome (mortality
). There are time-invariant confounders (age
,sex
) and a time-varying confounder (pain
, which is a truncated normal distribution), and a clustering variable (site
).Here is a dataset:
Here is my code using gfoRmula:
I get the following error message:
I'm not sure what is causing the error specifically. Any assistance would be appreciated.
Thanks,
Ben