feepred | R Documentation |
Computes the predicted count distribution from a fitted model of class "oneinflmodel"
,
"truncmodel"
, or "basicPoisson"
. The function returns the expected frequency
for each count value from 1 up to maxpred
, based on the model's parameters.
feepred(model, data, maxpred)
model |
A fitted model object of class |
data |
A data frame containing the covariates used to fit the model. |
maxpred |
Optional integer specifying the maximum count value for which to compute predicted frequencies. If not supplied, defaults to the maximum observed count in the data. |
The function determines the model type based on its class and the dist
attribute, and applies the appropriate
density function:
For oneinflmodel
(Poisson): one-inflated positive Poisson distribution.
For oneinflmodel
(negbin): one-inflated zero-truncated negative binomial.
For truncmodel
(Poisson): truncated positive Poisson.
For truncmodel
(negbin): zero-truncated negative binomial.
A numeric vector of length maxpred
, giving the predicted expected frequency of each count from 1 to maxpred
.
feeplot
, fee
, dfee
df <- data.frame(x = runif(10,0,10), d = sample(c(0,1), 10, replace=TRUE), y = rpois(10, 3) + 1)
model <- oneinfl::oneinfl(formula = y ~ x + d | x + d, df = df, dist = "Poisson")
feepred(model, data = df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.