Default returns response residuals (y_on_scale - fitted) on the model's
native scale. type = "pearson" divides by the residual SD on the model
scale (exp(coef[["logsigma_e"]])). Requesting type = "pearson" with
scale = "natural" falls back to type = "response" with a message
because a response-scale residual SD is not identified for the
exponential/zben variants without a separate variance assumption.
Arguments
- object
A
beezdemand_tmbobject.- type
One of
"response"(default) or"pearson".- scale
One of
"model"(default) or"natural".- level
One of
"subject"(default; conditions on the subject random effects) or"population"(random effects set to zero, giving the population-mean values). Seepredict.beezdemand_tmb().- ...
Unused.
Examples
# \donttest{
data(apt)
fit <- fit_demand_tmb(apt, equation = "exponential", verbose = 0)
#> equation='exponential': Dropped 14 zero-consumption observations (146 remaining).
head(residuals(fit))
#> [1] -0.005808747 0.040421837 0.086273319 -0.091394740 -0.046292157
#> [6] -0.001559425
head(residuals(fit, type = "pearson"))
#> [1] -0.04082061 0.28406198 0.60628047 -0.64227094 -0.32531530 -0.01095876
# }
