Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in offset(years.in.study) : object 'years.in.study' not found #48

Open
jordanjohnlee24 opened this issue Oct 30, 2022 · 0 comments

Comments

@jordanjohnlee24
Copy link

Hello,

I am currently running a causal mediation analysis for a clinical trial where my mediator model uses a negative binomial regression model and my outcome model uses a logistic regression model.

model.x <- glm.nb(total.malaria.incident.events ~ Txarm + offset(years.in.study), data = delivery.analysis)
model.y = glm(compositeBO ~ Txarm + total.malaria.incident.events + offset(years.in.study), family = "binomial", data = delivery.analysis)
m.out = mediate(malaria.glm.nb, model.3.malaria.compositeBO, treat = "Txarm", mediator = "total.malaria.incident.events", boot=T)

However, I get the following error: Error in offset(years.in.study) : object 'years.in.study' not found
Does the mediate package allow for an "offset" function to be in the model because the time each participant contributes varies? If so, how can I correct this error? If not, is there another way to handle these models?

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant