Open wds15 opened 6 years ago
Thanks for reporting. Not sure what the problem is but will look into it. It might work if you use the offset argument instead of putting it in the formula.
This offset problem still exists in the current version of rstanarm
:
require(rstanarm)
fit = stan_gamm4(carb ~ gear + s(mpg), offset = log(disp),
family=poisson(),
data = mtcars, chains = 1, iter = 200)
> fit = stan_gamm4(carb ~ gear + s(mpg), offset = log(disp),
+ family=poisson(),
+ data = mtcars, chains = 1, iter = 200)
Error in stan_glm.fit(x = X, y = y, weights = weights, offset = offset, :
formal argument "offset" matched by multiple actual arguments
My rstanarm
and rstan
version is 2.18.2. My R
version is 3.6.0.
Summary:
The offsets don't work right in stan_gamm4. The example here is for a gaussian family, but it is particularly harmful in poisson regression.
Description:
Specifying an offset inside the formula or as argument to the function does not work if the offset referred to is a column inside the data frame. This is also problematic when predicting.
Reproducible Steps:
RStanARM Version:
2.17.2
R Version:
3.4.3
Operating System:
Your operating system (e.g., OS X 10.11.3)