lgc {semnova}R Documentation

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 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


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)


[Package semnova version 0.1-6 Index]