Title: | Modeling Complex Longitudinal Data in a Quick and Easy Way |
---|---|
Description: | Matching longitudinal methodology models with complex sampling design. It fits fixed and random effects models and covariance structured models so far. It also provides tools to perform statistical tests considering these specifications as described in : Pacheco, P. H. (2021). "Modeling complex longitudinal data in R: development of a statistical package." <https://repositorio.ufjf.br/jspui/bitstream/ufjf/13437/1/pedrohenriquedemesquitapacheco.pdf>. |
Authors: | Pedro Pacheco [aut, cre]
|
Maintainer: | Pedro Pacheco <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.0 |
Built: | 2025-02-19 04:15:43 UTC |
Source: | https://github.com/cran/Mmcsd |
Responsible for performing the modeling of the model's covariance matrix through the use of covariance structures.
cov_mmcsd(fit, fittingType, sigmaThetaExpr, optimParams)
cov_mmcsd(fit, fittingType, sigmaThetaExpr, optimParams)
fit |
A fit model with class 'mmcsd' |
fittingType |
A character with the fitting function type. See optins above |
sigmaThetaExpr |
A character with the covariance structure type or a list of expressions |
optimParams |
A list with configuration for optim function. 'Par' is required. |
The fit model with class 'mmcsd.theta'.
fit <- mmcsd( score ~ wave + ageg + ecacg + qualifg, waves = wave, ids = id, weights = weight, stratum = strata, cluster = cluster, data = example_data, sigma = "exchangeable" ) fitTheta_ucm <- cov_mmcsd(fit, fittingType = "PML", sigmaThetaExpr = "UCM", optimParams = list(par = c(7, 5)) )
fit <- mmcsd( score ~ wave + ageg + ecacg + qualifg, waves = wave, ids = id, weights = weight, stratum = strata, cluster = cluster, data = example_data, sigma = "exchangeable" ) fitTheta_ucm <- cov_mmcsd(fit, fittingType = "PML", sigmaThetaExpr = "UCM", optimParams = list(par = c(7, 5)) )
An example dataset containing the individuals scores for certain subject.
example_data
example_data
A data frame with 6700 rows and 9 variables:
respondent id
wave number
respondent score
sampling weight
strata variable
cluster variable
cathegorical age
educational level
economic activity
Estimate the fixed effects of the model, also known as B parameters of the regression,taking into account the sampling plan of the research, and also estimating the covariance matrix of the model considering the estimates of B
mmcsd(formula, waves, ids, weights, stratum, cluster, data, sigma = "identity")
mmcsd(formula, waves, ids, weights, stratum, cluster, data, sigma = "identity")
formula |
A formula |
waves |
a dataframe column or an array |
ids |
a dataframe column or an array |
weights |
a dataframe column or an array |
stratum |
a dataframe column or an array |
cluster |
a dataframe column or an array |
data |
A dataframe or tibble |
sigma |
A character or a square matrix |
The fit model with class 'mmcsd'.
fit <- mmcsd( score ~ wave + ageg + ecacg + qualifg, waves = wave, ids = id, weights = weight, stratum = strata, cluster = cluster, data = example_data, sigma = "exchangeable" )
fit <- mmcsd( score ~ wave + ageg + ecacg + qualifg, waves = wave, ids = id, weights = weight, stratum = strata, cluster = cluster, data = example_data, sigma = "exchangeable" )
Knowing the difficulty of visualizing the covariance structure, especially when the user chooses to determine his own structure. This function was developed,that allows the user to view the provided structure even before it is evaluated, that is, through mathematics symbolic.
sigmaThetaExpr_viewer(sigmaThetaExpr, numWaves = NULL)
sigmaThetaExpr_viewer(sigmaThetaExpr, numWaves = NULL)
sigmaThetaExpr |
A character with the covariance structure type or a list of expressions |
numWaves |
An integer with the size of the square matrix to be printed. |
Return NULL and print in terminal the sigmaThetaExpr.
sigmaThetaExpr_viewer("UCM", 5)
sigmaThetaExpr_viewer("UCM", 5)
Summarise the results of 'mmcsd' fit.
## S3 method for class 'mmcsd' summary(object, ...)
## S3 method for class 'mmcsd' summary(object, ...)
object |
A mmcsd fitted model |
... |
Additional params passed to summary |
Return NULL and print in terminal the results.
fit <- mmcsd( score ~ wave + ageg + ecacg + qualifg, waves = wave, ids = id, weights = weight, stratum = strata, cluster = cluster, data = example_data, sigma = "exchangeable" ) summary(fit)
fit <- mmcsd( score ~ wave + ageg + ecacg + qualifg, waves = wave, ids = id, weights = weight, stratum = strata, cluster = cluster, data = example_data, sigma = "exchangeable" ) summary(fit)
Summarise the results of 'cov_mmcsd' fit.
## S3 method for class 'mmcsd.theta' summary(object, ...)
## S3 method for class 'mmcsd.theta' summary(object, ...)
object |
A mmcsd.theta fitted model |
... |
Additional params passed to summary |
Return NULL and print in terminal the results.
fit <- mmcsd( score ~ wave + ageg + ecacg + qualifg, waves = wave, ids = id, weights = weight, stratum = strata, cluster = cluster, data = example_data, sigma = "exchangeable" ) fitTheta_ucm <- cov_mmcsd(fit, fittingType = "PML", sigmaThetaExpr = "UCM", optimParams = list(par = c(7, 5)) ) summary(fitTheta_ucm)
fit <- mmcsd( score ~ wave + ageg + ecacg + qualifg, waves = wave, ids = id, weights = weight, stratum = strata, cluster = cluster, data = example_data, sigma = "exchangeable" ) fitTheta_ucm <- cov_mmcsd(fit, fittingType = "PML", sigmaThetaExpr = "UCM", optimParams = list(par = c(7, 5)) ) summary(fitTheta_ucm)