0

I was wondering if anyone knows whether sjPlot can be used for a Poisson model with an offset term. I tried to do that and I received a message saying that it cannot find the name of offset term.

Any help would be appreciated! M

4

1 回答 1

1

Ok, the error message was because the column name in the model frame still was offset(logExposure), while the functions searched for the cleaned variable name logExposure.

Cleaning is done by calling sjstats::var_names(), so I fixed this issue there. I had no reproducible example, so I checked with an own model, and the issue was resolved - I hope, this also applies to your use-case.

You should update sjstats from GitHub (devtools::install_github("strengejacke/sjstats")), and then ggeffects and sjPlot should work (if you have the latest package versions from CRAN, and use plot_model() from sjPlot).

If the variable is named logExposure, your call would look like this:

# for ggeffects
ggpredict(mof1, terms = c("visits", "age", "logExposure"))
# for sjPlot
plot_model(mof1, type = "pred", terms = c("visits", "age", "logExposure")) 
于 2017-10-25T17:53:46.723 回答