Closed maxsitt closed 2 years ago
Works for me, this may have been fixed meanwhile.
library(pscl)
#> Classes and Methods for R developed in the
#> Political Science Computational Laboratory
#> Department of Political Science
#> Stanford University
#> Simon Jackman
#> hurdle and zeroinfl functions by Achim Zeileis
set.seed(123)
N <- 100 # Samples
x <- runif(N, 0, 10) # Predictor
off <- rgamma(N, 3, 2) # Offset variable
yhat <- -1 + x * 0.5 + log(off) # Prediction on log scale
y <- rpois(N, exp(yhat)) # Poisson process
y <- ifelse(rbinom(N, 1, 0.3), 0, y) # Zero-inflation process
d <- data.frame(y = y, x, logOff = log(off)) # Storage dataframe
m1 <- zeroinfl(y ~ offset(logOff) + x | 1, data = d, dist = "poisson")
report::report(m1)
#> We fitted a zero-inflated poisson model to predict y with logOff and x (formula: y ~ offset(logOff) + x). The model's explanatory power is substantial (R2 = 1.00, adj. R2 = 1.00). The model's intercept, corresponding to logOff = 0 and x = 0, is at -0.92 (95% CI [-1.20, -0.64], p < .001). Within this model:
#>
#> - The effect of x is statistically significant and positive (beta = 0.49, 95% CI [0.45, 0.52], p < .001; Std. beta = 1.52, 95% CI [1.42, 1.63])
#>
#> Standardized parameters were obtained by fitting the model on a standardized version of the dataset.
Created on 2022-07-05 by the reprex package (v2.0.1)
Can you confirm that it works for you, too?
Just checked it and now it works for me too! Thanks :)
When using report(model) with models (LM, GLM, GLMM) including an offset term (e.g. offset = log(days)), I get the following error message:
Error in eval(extras, data, env) : object 'days' not found
Would be nice to include support for models with an offset term. Thanks!