fee | R Documentation |
Computes the first-exposure effect (FEE) from a fitted 'oneinfl' model object. The FEE measures the difference between the expected count for a first-time exposure and the expected count under the baseline (non-inflated) model. The function supports models estimated using either a one-inflated positive Poisson distribution or a one-inflated zero-truncated negative binomial distribution.
fee(model, data, at = "AE")
model |
A fitted model object of class |
data |
The original data frame used to fit the model. |
at |
A character string or list. Specifies how the first-exposure effect should be evaluated.
Options are |
The effect can be evaluated in three ways, determined by the 'at' argument:
"AE"
: Average the FEE over all data points (default).
"EM"
: Evaluate the FEE at the sample means of the covariates.
list
: Evaluate the FEE at a user-specified set of covariate values.
If 'at = "AE"', the returned object also includes the total number of treatment visits implied by the FEE across all observations.
A list with components:
fee
The estimated first-exposure effect.
sefee
The standard error of the estimated effect.
where
A character string describing the evaluation point.
treatment_visits
(Optional) Total implied treatment visits if at = "AE"
.
# Example usage
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")
fee(model, data = df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.