countreg {lavacreg} | R Documentation |
Fitting Count Regression Models with Latent Covariates
Description
This function is the main function of the package and can be used to estimate latent variable count regression models in one or multiple group(s).
Usage
countreg(
forml,
data,
lv = NULL,
group = NULL,
family = "poisson",
silent = FALSE,
se = TRUE,
creg_options = NULL
)
Arguments
forml |
An object of class |
data |
A data frame containing all variables specified in |
lv |
A named list, where names of elements represent the names of the
latent variables and each element consists of a character vector containing
variable names of indicators for the respective latent variable, e.g.,
|
group |
A group variable. If specified, the regression model specified
in |
family |
A character indicating the family of the generalized linear
model to be estimated. At the moment, |
silent |
Logical. Should informations about the estimation process be suppressed? (Defaults to FALSE) |
se |
Logical. Should standard errors be computed? Defaults to TRUE. (Can take a while for complex models) |
creg_options |
optional list of additional options for the estimation procedure |
Value
An object of type lavacreg
. Use summary(object)
to
print results containing parameter estimates and their standard errors.
Examples
fit <- countreg(forml = "dv ~ z11", data = example01, family = "poisson")
summary(fit)
fit <- countreg(
forml = "dv ~ eta1 + z11 + z21",
lv = list(eta1 = c("z41", "z42", "z43")),
group = "treat",
data = example01,
family = "poisson"
)
summary(fit)