lgc: General function to specify a general latent growth...

Description Usage Arguments Value Examples

View source: R/lgc.R

Description

General function to specify a general latent growth components model.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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 mmodel. If not provided, manifest variables from the formula object will be used. Otherwise, use create_mmodel() to specify measurement model.

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: c("wilks", "wald"). Default is multiv_tests = c("wilks", "wald").

univ_tests

Character vector. Univariate test statistics that are to be computed. Possible statistics are: c("F"). Default is univ_tests = NULL.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)

semnova documentation built on July 1, 2020, 10:43 p.m.