Title: | Latent Variable Count Regression Models |
---|---|
Description: | Estimation of a multi-group count regression models (i.e., Poisson, negative binomial) with latent covariates. This packages provides two extensions compared to ordinary count regression models based on a generalized linear model: First, measurement models for the predictors can be specified allowing to account for measurement error. Second, the count regression can be simultaneously estimated in multiple groups with stochastic group weights. The marginal maximum likelihood estimation is described in Kiefer & Mayer (2020) <doi:10.1080/00273171.2020.1751027>. |
Authors: | Christoph Kiefer [cre, aut] |
Maintainer: | Christoph Kiefer <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.2-2 |
Built: | 2024-11-10 03:44:38 UTC |
Source: | https://github.com/chkiefer/lavacreg |
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).
countreg( forml, data, lv = NULL, group = NULL, family = "poisson", silent = FALSE, se = TRUE, creg_options = NULL )
countreg( forml, data, lv = NULL, group = NULL, family = "poisson", silent = FALSE, se = TRUE, creg_options = NULL )
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 |
An object of type lavacreg
. Use summary(object)
to
print results containing parameter estimates and their standard errors.
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)
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)
A dataset containing 9 variables: a dependent variable dv, a group variable treat and 7 indicators for 3 latent covariates.
example01
example01
A data frame with 871 rows and 9 variables:
Count of correctly-answered items (dependent variable)
Treatment group variable, where 0
is control and 2
is treatment
First indicator of internal LoC
Second indicator of internal LoC
First indicator of external LoC
Second indicator of external LoC
First indicator of depression
Second indicator of depression
Third indicator of depression
Checks if the variable is a count variable
is_count(x, tol = .Machine$double.eps^0.5)
is_count(x, tol = .Machine$double.eps^0.5)
x |
vector to be checked |
tol |
Tolerance |
Function returns logical value indicating whether x can be considered a count variable or not.
Exports the parameter table with parameter estimates and standard errors for an estimated latent variable count regression model.
## S4 method for signature 'lavacreg' summary(object)
## S4 method for signature 'lavacreg' summary(object)
object |
lavacreg object |
Function prints the parameter table of an estimated model, which includes the parameter estimates and standard errors.