Type: | Package |
Title: | Latent Repeated Measures ANOVA |
Version: | 0.1-6 |
Author: | Benedikt Langenberg [aut, cre], Axel Mayer [ctb] |
Imports: | lavaan, Matrix, parallel, MASS, stats, methods |
Suggests: | testthat, knitr, rmarkdown |
Depends: | R (≥ 3.4.0) |
Description: | Latent repeated measures ANOVA (L-RM-ANOVA) is a structural equation modeling based alternative to traditional repeated measures ANOVA. L-RM-ANOVA extends the latent growth components approach by Mayer et al. (2012) <doi:10.1080/10705511.2012.713242> and introduces latent variables to repeated measures analysis. |
Maintainer: | Benedikt Langenberg <benedikt.langenberg@gmail.com> |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.0 |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2020-06-18 13:31:54 UTC; benedicens |
Repository: | CRAN |
Date/Publication: | 2020-06-19 05:50:07 UTC |
Comparing the fit of LGC objects.
Description
Comparing the fit of LGC objects.
Usage
## S4 method for signature 'lgc'
anova(object, ...)
Arguments
object |
|
... |
|
Specifying a measurement model.
Description
Specifying a measurement model.
Usage
create_mmodel(..., list = NULL, lv_scaling = "effect", invariance = NULL)
Arguments
... |
Named arguments each representing a latent variable. The arguments are character vectors containing the variable names the latent variables are measured by. |
list |
List. Each list element represents a latent variable. List elements are character vectors containing the variable names the latent variables are measured by. |
lv_scaling |
Character vector. Defines the strategy for latent variable scaling.
Default is |
invariance |
Not yet implemented. |
Value
Object of classe mmodel
.
Examples
mmodel <- create_mmodel(
A1B1 = "var1",
A2B1 = "var2",
A3B1 = "var3",
A1B2 = "var4",
A2B2 = "var5",
A3B2 = "var6",
lv_scaling = "referent"
)
General function to specify a general latent growth components model.
Description
General function to specify a general latent growth components model.
Usage
lgc(
data,
mmodel,
C_matrix,
hypotheses = NULL,
covariates = NULL,
groups = NULL,
append = NULL,
verbose = FALSE,
compound_symmetry = FALSE,
sphericity = FALSE,
multiv_tests = c("wilks", "wald"),
univ_tests = NULL,
randomization = list(ncores = 1, nsamples = 1000),
...
)
Arguments
data |
Dataframe. Data object to be passed to lavaan. |
mmodel |
Object of class |
C_matrix |
Contrast matrix. Must be invertible. |
hypotheses |
List of numeric vectors. Each list element represents a hypothesis. For each hypothesis, the contrasts indicated by the elements of the vectors are tested against zero. |
covariates |
Not implemented yet. |
groups |
Not implemented yet. |
append |
Character. Syntax that is to be appended to lavaan syntax. |
verbose |
Boolean. Print details during procedure. |
compound_symmetry |
Boolean. When set to TRUE, compound symmetry is assumed. |
sphericity |
Boolean or formula. When set to TRUE, sphericity is assumed for all effects. |
multiv_tests |
Character vector. Multivariate test statistics that are to be computed.
Possible statistics are: |
univ_tests |
Character vector. Univariate test statistics that are to be computed.
Possible statistics are: |
randomization |
Not yet supported. |
... |
Additional arguments to be passed to lavaan. |
Value
Function returns an lgc object. Use summary(object)
to print
hypotheses. Otherwise use object@sem_obj
to get access to the underlying
lavaan object.
Examples
set.seed(323412431)
data("semnova_test_data", package = "semnova")
mmodel <- create_mmodel(
A1B1 = "var1",
A2B1 = "var2",
A3B1 = "var3",
A1B2 = "var4",
A2B2 = "var5",
A3B2 = "var6",
lv_scaling = "referent"
)
hypotheses <- list(
Intercept = c(1),
A = c(2, 3),
B = c(4),
AB = c(5, 6)
)
C_matrix <- matrix(
c(1, 1, 0, 1, 1, 0,
1, 0, 1, 1, 0, 1,
1,-1,-1, 1,-1,-1,
1, 1, 0,-1,-1, 0,
1, 0, 1,-1, 0,-1,
1,-1,-1,-1, 1, 1),
nrow=6
)
fit_lgc <- lgc(data = semnova_test_data, mmodel, C_matrix, hypotheses)
summary(fit_lgc)
LGC Class.
Description
LGC Class.
Latent repeated-measures ANOVA using the LGC approach
Description
Function specifies an LGC model. The idata object is used to create
the contrast matrix that is passed to the lgc()
function. Typical
hypotheses are specified as well.
Usage
semnova(
formula,
idesign,
idata,
data,
mmodel = NULL,
covariates = NULL,
groups = NULL,
append = NULL,
icontrasts = c("contr.poly", "contr.sum"),
verbose = FALSE,
compound_symmetry = FALSE,
sphericity = FALSE,
multiv_tests = c("wilks", "wald"),
univ_tests = c("F"),
randomization = list(ncores = 1, nsamples = 1000),
...
)
Arguments
formula |
Formula. |
idesign |
Formula. Within-subjects design formula. |
idata |
Dataframe. The dataframe contains the factorial design. |
data |
Dataframe. Data object to be passed to lavaan. |
mmodel |
Object of class |
covariates |
Not implemented yet. |
groups |
Not implemented yet. |
append |
Character vector. Syntax that is to be appended to lavaan syntax. |
icontrasts |
Character vector. Use this argument to select the type of contrasts to be used.
Default is |
verbose |
Boolean. Print details during procedure. |
compound_symmetry |
Boolean. When set to TRUE, compound symmetry is assumed among dependent variables. |
sphericity |
Boolean or formula. When set to TRUE, sphericity is assumed for all effects. |
multiv_tests |
Character vector. Multivariate test statistics that are to be computed.
Possible statistics are: |
univ_tests |
Character vector. Univariate test statistics that are to be computed.
Possible statistics are: |
randomization |
Not yet supported. |
... |
Additional arguments to be passed to lavaan. |
Value
Function returns an lgc object. Use summary(object)
to print
hypotheses. Otherwise use object@sem_obj
to get access to the underlying
lavaan object.
Examples
set.seed(323412431)
data("semnova_test_data", package = "semnova")
idata <- expand.grid(A = c("A1", "A2", "A3"), B = c("B1", "B2"))
mmodel <- create_mmodel(
A1B1 = "var1",
A2B1 = "var2",
A3B1 = "var3",
A1B2 = "var4",
A2B2 = "var5",
A3B2 = "var6",
lv_scaling = "referent"
)
fit_semnova <-
semnova(
formula = cbind(A1B1, A2B1, A3B1, A1B2, A2B2, A3B2) ~ 1,
data = semnova_test_data,
idata = idata,
idesign = ~ A * B,
mmodel = mmodel
)
summary(fit_semnova)
This data set serves for examples and tests.
Description
This is a simulated data set that 100 observation of six normally distributed variables with mean = 0, variance = 1 and covariance 0.5.
Usage
semnova_test_data
Format
A data frame with 100 rows and 6 variables:
Printing the summary for an LGC object.
Description
Printing the summary for an LGC object.
Usage
## S4 method for signature 'lgc'
summary(object, ...)
Arguments
object |
|
... |
Additional arguments. Currently none supported. |