feeplot | R Documentation |
Creates a bar plot of the observed count data overlaid with fitted values from
a oneinfl
model and its associated counterfactual (non-inflated) model.
feeplot(model, data, maxpred, ylimit, cex = 1.5, lwd = 1.5, ...)
model |
A fitted object of class |
data |
A data frame containing the original data used to fit the model. |
maxpred |
Optional integer indicating the maximum count value to include on the x-axis.
Defaults to the maximum observed value in |
ylimit |
Optional numeric value specifying the upper limit of the y-axis. Defaults to 110% of the maximum observed count frequency. |
cex |
A numeric value for point size in the overlay plot. Defaults to |
lwd |
A numeric value for line width in the overlay plot. Defaults to |
... |
Additional arguments passed to |
The factual predictions come from the fitted oneinfl
model, while the
counterfactual distribution is obtained by transforming the model into a non-inflated
counterpart using the same estimated parameters.
The function detects whether the model is based on a Poisson or negative binomial distribution and selects the appropriate counterfactual model.
A barplot with overlaid predicted values from the factual and counterfactual distributions, including a legend identifying each component.
feepred
, 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")
feeplot(model, data = df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.