semPower.powerARMA {semPower}R Documentation

semPower.powerARMA

Description

Convenience function for performing power analysis on effects in an ARMA model. This requires the lavaan package.

Usage

semPower.powerARMA(
  type,
  comparison = "restricted",
  nWaves = NULL,
  autoregEffects = NULL,
  autoregLag1 = autoregEffects,
  autoregLag2 = NULL,
  autoregLag3 = NULL,
  mvAvgLag1 = NULL,
  mvAvgLag2 = NULL,
  mvAvgLag3 = NULL,
  means = NULL,
  variances = NULL,
  waveEqual = NULL,
  groupEqual = NULL,
  nullEffect = NULL,
  nullWhich = NULL,
  nullWhichGroups = NULL,
  invariance = TRUE,
  autocorResiduals = TRUE,
  ...
)

Arguments

type

type of power analysis, one of 'a-priori', 'post-hoc', 'compromise'.

comparison

comparison model, one of 'saturated' or 'restricted' (the default). This determines the df for power analyses. 'saturated' provides power to reject the model when compared to the saturated model, so the df equal the one of the hypothesized model. 'restricted' provides power to reject the hypothesized model when compared to an otherwise identical model that just omits the restrictions defined in nullEffect, so the df equal the number of restrictions.

nWaves

number of waves, must be >= 2.

autoregEffects

vector of the lag-1 autoregressive effects, e.g. c(.7, .6) for autoregressive effects of .7 for X1 -> X2 and .6 for X2 -> X3. Must be a list for multiple groups models.

autoregLag1

alternative name for autoregEffects.

autoregLag2

vector of lag-2 effects, e.g. c(.2, .1) for lag-2 effects of .2 for X1 -> X3 and .1 for X2 -> X4.

autoregLag3

vector of lag-3 effects, e.g. c(.2) for a lag-3 effect of .2 for X1 -> X4.

mvAvgLag1

vector of the lag-1 moving average parameters, e.g. c(.4, .3) for moving average parameters of .4 for N1 -> X2 and .3 for N2 -> X3. Must be a list for multiple groups models.

mvAvgLag2

vector of the lag-2 moving average parameters, e.g. c(.3, .2) for moving average parameters effects of .2 for N1 -> X3 and .2 for N2 -> X4. Must be a list for multiple groups models.

mvAvgLag3

vector of the lag-3 moving average parameters, e.g. c(.2) for a moving average parameter of .2 for N1 -> X4. Must be a list for multiple groups models.

means

vector of means of X. May be NULL for no meanstructure.

variances

vector of variances of the noise factors N (= residual variances of X).

waveEqual

parameters that are assumed to be equal across waves in both the H0 and the H1 model. Because ARMA models are likely not identified when no such constraints are imposed, this may not be empty. Valid are 'autoreg', 'autoregLag2', and 'autoregLag3' for autoregressive effects, 'mvAvg', 'mvAvgLag2', and 'mvAvgLag3' for moving average effects, var for the variance of the noise factors (starting at wave 2), mean for the conditional means of X (starting at wave 2).

groupEqual

parameters that are restricted across groups in both the H0 and the H1 model, when nullEffect implies a multiple group model. Valid are autoreg, mvAvg, var, mean.

nullEffect

defines the hypothesis of interest. Valid are the same arguments as in waveEqual and additionally 'autoreg = 0', 'autoregLag2 = 0', 'autoregLag3 = 0', 'mvAvg = 0', 'mvAvgLag2 = 0', 'mvAvgLag3 = 0', to constrain the autoregressive or moving average effects to zero, and 'autoregA = autoregB', 'mvAvgA = mvAvgB', 'varA = varB', 'meanA = meanB' to constrain the autoregressive (lag-1) effects, moving average (lag-1) effects, variances of the noise factors, or means of the X to be equal across groups.

nullWhich

used in conjunction with nullEffect to identify which parameter to constrain when there are multiple waves and parameters are not constant across waves. For example, nullEffect = 'autoreg = 0' with nullWhich = 2 would constrain the second autoregressive effect for X to zero.

nullWhichGroups

for hypothesis involving cross-groups comparisons, vector indicating the groups for which equality constrains should be applied, e.g. c(1, 3) to constrain the relevant parameters of the first and the third group. If NULL, all groups are constrained to equality.

invariance

whether metric invariance over waves is assumed (TRUE, the default) or not (FALSE). When means are part of the model, invariant intercepts are also assumed. This affects the df when the comparison model is the saturated model and generally affects power (also for comparisons to the restricted model).

autocorResiduals

whether the residuals of the indicators of latent variables are autocorrelated over waves (TRUE, the default) or not (FALSE). This affects the df when the comparison model is the saturated model and generally affects power (also for comparisons to the restricted model).

...

mandatory further parameters related to the specific type of power analysis requested, see semPower.aPriori(), semPower.postHoc(), and semPower.compromise(), and parameters specifying the factor model. The order of factors is (X1, X2, ..., X_nWaves). See details.

Details

This function performs a power analysis to reject various hypotheses arising in models with autoregressive and moving average parameters (ARMA models), where one variable X is repeatedly assessed at different time points (nWaves), and autoregressive (lag-1 effects; X1 -> X2 -> X3, and optionally lag-2 and lag-3) effects, and moving average parameters (N1 -> X2, or equivalently for lag-2 and lag-3 effects) are assumed.

Relevant hypotheses in arising in an ARMA model are:

For hypotheses regarding a simple autoregression, see semPower.powerAutoreg(). For hypotheses regarding a CLPM structure, see semPower.powerCLPM(). For hypotheses regarding longitudinal measurement invariance, see semPower.powerLI().

Beyond the arguments explicitly contained in the function call, additional arguments are required specifying the factor model and the requested type of power analysis.

Additional arguments related to the definition of the factor model:

So either Lambda, or loadings, or nIndicator and loadM need to be defined. Note that neither may contain the noise factors. If the model contains observed variables only, use Lambda = diag(x) where x is the number of variables.

The order of the factors is (X1, X2, ..., X_nWaves).

Additional arguments related to the requested type of power analysis:

If a simulated power analysis (simulatedPower = TRUE) is requested, optional arguments can be provided as a list to simOptions:

type = 'IG' implements the independent generator approach (IG, Foldnes & Olsson, 2016) approach specifying third and fourth moments of the marginals, and thus requires that skewness (skewness) and excess kurtosis (kurtosis) for each variable are provided as vectors. This requires the covsim package.

type = 'mnonr' implements the approach suggested by Qu, Liu, & Zhang (2020) and requires provision of Mardia's multivariate skewness (skewness) and kurtosis (kurtosis), where skewness must be non-negative and kurtosis must be at least 1.641 skewness + p (p + 0.774), where p is the number of variables. This requires the mnonr package.

type = 'RK' implements the approach suggested by Ruscio & Kaczetow (2008) and requires provision of the population distributions of each variable (distributions). distributions must be a list (if all variables shall be based on the same population distribution) or a list of lists. Each component must specify the population distribution (e.g. rchisq) and additional arguments (list(df = 2)).

type = 'VM' implements the third-order polynomial method (Vale & Maurelli, 1983) specifying third and fourth moments of the marginals, and thus requires that skewness (skewness) and excess kurtosis (kurtosis) for each variable are provided as vectors. This requires the semTools package.

Value

a list. Use the summary method to obtain formatted results. Beyond the results of the power analysis and a number of effect size measures, the list contains the following components:

Sigma

the population covariance matrix. A list for multiple group models.

mu

the population mean vector or NULL when no meanstructure is involved. A list for multiple group models.

SigmaHat

the H0 model implied covariance matrix. A list for multiple group models.

muHat

the H0 model implied mean vector or NULL when no meanstructure is involved. A list for multiple group models.

modelH0

lavaan H0 model string.

modelH1

lavaan H1 model string or NULL when the comparison refers to the saturated model.

simRes

detailed simulation results when a simulated power analysis (simulatedPower = TRUE) was performed.

See Also

semPower.genSigma() semPower.aPriori() semPower.postHoc() semPower.compromise()

Examples

## Not run: 
# Determine required N in a 10-wave ARMA model
# to detect that the autoregressive effects differ across waves
# with a power of 80% on alpha = 5%, where
# X is measured by 3 indicators loading by .5 each (at each wave), and
# the autoregressive effects vary between .5 and .7, and
# the moving average parameters are .3 at each wave and
# are assumed to be constant across waves (in both the H0 and the H1 model) and
# there are no lagged effects, and
# metric invariance and autocorrelated residuals are assumed
powerARMA <- semPower.powerARMA(
  'a-priori', alpha = .05, power = .80,
  nWaves = 10,
  autoregLag1 = c(.5, .7, .6, .5, .7, .6, .6, .5, .6),
  mvAvgLag1 = rep(.3, 9),
  variances = rep(1, 10),
  waveEqual = c('mvAvg'),
  nullEffect = 'autoreg',
  nIndicator = rep(3, 10), loadM = .5,
  invariance = TRUE, 
  autocorResiduals = TRUE
)

# show summary
summary(powerARMA)
# optionally use lavaan to verify the model was set-up as intended
lavaan::sem(powerARMA$modelH1, sample.cov = powerARMA$Sigma,
            sample.nobs = powerARMA$requiredN,
            sample.cov.rescale = FALSE)
lavaan::sem(powerARMA$modelH0, sample.cov = powerARMA$Sigma,
            sample.nobs = powerARMA$requiredN,
            sample.cov.rescale = FALSE)


# same as above, but determine power with N = 250 on alpha = .05
powerARMA <- semPower.powerARMA(
  'post-hoc', alpha = .05, N = 250,
  nWaves = 10,
  autoregLag1 = c(.5, .7, .6, .5, .7, .6, .6, .5, .6),
  mvAvgLag1 = rep(.3, 9),
  variances = rep(1, 10),
  waveEqual = c('mvAvg'),
  nullEffect = 'autoreg',
  nIndicator = rep(3, 10), loadM = .5,
  invariance = TRUE, 
  autocorResiduals = TRUE
)

# same as above, but determine the critical chi-square with N = 250 so that alpha = beta
powerARMA <- semPower.powerARMA(
  'compromise', abratio = 1, N = 250,
  nWaves = 10,
  autoregLag1 = c(.5, .7, .6, .5, .7, .6, .6, .5, .6),
  mvAvgLag1 = rep(.3, 9),
  variances = rep(1, 10),
  waveEqual = c('mvAvg'),
  nullEffect = 'autoreg',
  nIndicator = rep(3, 10), loadM = .5,
  invariance = TRUE, 
  autocorResiduals = TRUE
)
  
# same as above, but compare to the saturated model
# (rather than to the less restricted model)
powerARMA <- semPower.powerARMA(
  'a-priori', alpha = .05, power = .80, comparison = 'saturated',
  nWaves = 10,
  autoregLag1 = c(.5, .7, .6, .5, .7, .6, .6, .5, .6),
  mvAvgLag1 = rep(.3, 9),
  variances = rep(1, 10),
  waveEqual = c('mvAvg'),
  nullEffect = 'autoreg',
  nIndicator = rep(3, 10), loadM = .5,
  invariance = TRUE, 
  autocorResiduals = TRUE
)


# same as above, but assume only observed variables
powerARMA <- semPower.powerARMA(
  'a-priori', alpha = .05, power = .80,
  nWaves = 10,
  autoregLag1 = c(.5, .7, .6, .5, .7, .6, .6, .5, .6),
  mvAvgLag1 = rep(.3, 9),
  variances = rep(1, 10),
  waveEqual = c('mvAvg'),
  nullEffect = 'autoreg',
  Lambda = diag(1, 10),
  invariance = TRUE, 
  autocorResiduals = TRUE
)

# same as above, but provide reduced loadings matrix to define that
# X is measured by 3 indicators each loading by .5, .6, .4 (at each wave)
powerARMA <- semPower.powerARMA(
  'a-priori', alpha = .05, power = .80,
  nWaves = 10,
  autoregLag1 = c(.5, .7, .6, .5, .7, .6, .6, .5, .6),
  mvAvgLag1 = rep(.3, 9),
  variances = rep(1, 10),
  waveEqual = c('mvAvg'),
  nullEffect = 'autoreg',
  loadings = list(
    c(.5, .6, .4),  # X1
    c(.5, .6, .4),  # X2
    c(.5, .6, .4),  # X3
    c(.5, .6, .4),  # X4
    c(.5, .6, .4),  # X5
    c(.5, .6, .4),  # X6
    c(.5, .6, .4),  # X7
    c(.5, .6, .4),  # X8
    c(.5, .6, .4),  # X9
    c(.5, .6, .4)   # X10
  ),
  invariance = TRUE, 
  autocorResiduals = TRUE
)

# same as above, but detect that the moving average parameters differ across waves
# with a power of 80% on alpha = 5%, where
# the moving average parameters vary between .05 and .4, and
# the autoregressive effects are .5 at each wave and
# are assumed to be constant across waves (in both the H0 and the H1 model)
powerARMA <- semPower.powerARMA(
  'a-priori', alpha = .05, power = .80,
  nWaves = 10,
  autoregLag1 = rep(.5, 9),
  mvAvgLag1 = c(.1, .05, .2, .1, .1, .3, .4, .4, .4),
  variances = rep(1, 10),
  waveEqual = c('autoreg'),
  nullEffect = 'mvAvg',
  nIndicator = rep(3, 10), loadM = .5,
  invariance = TRUE, 
  autocorResiduals = TRUE
)


# same as above, but detect that the (noise) variances differ across waves
# with a power of 80% on alpha = 5%, where
# the variances vary between 0.5 and 2, and
# the autoregressive effects are .5 at each wave and
# the moving average parameters are .3 at each wave and
# bothj are assumed to be constant across waves (in both the H0 and the H1 model)
powerARMA <- semPower.powerARMA(
  'a-priori', alpha = .05, power = .80,
  nWaves = 10,
  autoregLag1 = rep(.5, 9),
  mvAvgLag1 = rep(.3, 9),
  variances = c(1, .5, .7, .6, .7, .9, 1.2, 1.7, 2.0, 1.5),
  waveEqual = c('autoreg', 'mvAvg'),
  nullEffect = 'var',
  nIndicator = rep(3, 10), loadM = .5,
  invariance = TRUE, 
  autocorResiduals = TRUE
)


# same as above, but include a meanstructure and
# detect that the means differ across waves
# with a power of 80% on alpha = 5%, where
# the means vary between 0 and .5, and
# the autoregressive effects are .5 at each wave and
# the moving average parameters are .3 at each wave and
# the variances are 1 at each wave and
# all are assumed to be constant across waves (in both the H0 and the H1 model) and
# metric and scalar invariance is assumed
powerARMA <- semPower.powerARMA(
  'a-priori', alpha = .05, power = .80,
  nWaves = 10,
  autoregLag1 = rep(.5, 9),
  mvAvgLag1 = rep(.3, 9),
  variances = rep(1, 10),
  means = c(0, .1, .2, .3, .4, .5, .3, .4, .5, .5),
  waveEqual = c('autoreg', 'mvAvg', 'var'),
  nullEffect = 'mean',
  nIndicator = rep(3, 10), loadM = .5,
  invariance = TRUE, 
  autocorResiduals = TRUE
)

# Determine required N in a 10-wave ARMA model
# to detect that the autoregressive lag-2 effects differ from zero
# with a power of 80% on alpha = 5%, where
# the lag-2 autoregressive effects are .2 at each wave and 
# the lag-2 autoregressive effects are .1 at each wave and
# the autoregressive effects are .5 at each wave and
# the moving average parameters are .3 at each wave and
# the noise variances are equal to 1 in each wave,
# and all are assumed to be constant across waves (in both the H0 and the H1 model) and
# metric invariance and autocorrelated residuals are assumed, and
# the autoregressive lag2- and lag3-effects are estimated 
powerARMA <- semPower.powerARMA(
  'a-priori', alpha = .05, power = .80,
  nWaves = 10,
  autoregLag1 = rep(.5, 9),
  autoregLag2 = rep(.2, 8),
  autoregLag3 = rep(.1, 7),
  mvAvgLag1 = rep(.3, 9),
  variances = rep(1, 10),
  waveEqual = c('mvAvg', 'autoreg', 'var', 'autoreglag2', 'autoreglag3'),
  nullEffect = 'autoreglag2 = 0',
  nIndicator = rep(3, 10), loadM = .5,
  invariance = TRUE, 
  autocorResiduals = TRUE
)

# similar as above, but get required N to detect that 
# lag-2 moving average parameters are constant across waves 
powerARMA <- semPower.powerARMA(
  'a-priori', alpha = .05, power = .80,
  nWaves = 10,
  autoregLag1 = rep(.5, 9),
  autoregLag2 = rep(.2, 8),
  mvAvgLag1 = rep(.3, 9),
  mvAvgLag2 = c(.1, .2, .3, .1, .2, .3, .1, .1),
  variances = rep(1, 10),
  waveEqual = c('mvAvg', 'autoreg', 'var', 'autoreglag2'),
  nullEffect = 'mvAvgLag2',
  nIndicator = rep(3, 10), loadM = .5,
  invariance = TRUE
)


# Determine required N in a 5-wave ARMA model
# to detect that the autoregressive effects in group 1
# differ from the ones in group 2, where
# both groups are equal-sized
# with a power of 80% on alpha = 5%, where
# X is measured by 3 indicators loading by .5 each (at each wave and in each group), and
# the autoregressive effects in group 1 are .5 (constant across waves) and
# the autoregressive effects in group 2 are .6 (constant across waves) and
# the moving average parameters are .25 at each wave and in both groups and
# the variances are 1 at each wave and in both groups and 
# all are assumed to be constant across waves (in both the H0 and the H1 model)
# metric invariance (across both waves and groups) and
# autocorrelated residuals are assumed
powerARMA <- semPower.powerARMA(
  'a-priori', alpha = .05, power = .80, N = list(1, 1),
  nWaves = 5,
  autoregLag1 = list(
    c(.5, .5, .5, .5),   # group 1
    c(.6, .6, .6, .6)),  # group 2
  mvAvgLag1 = rep(.25, 4),
  variances = rep(1, 5),
  waveEqual = c('autoreg', 'var', 'mvavg'),
  nullEffect = 'autoregA = autoregB',
  nIndicator = rep(3, 5), loadM = .5,
  invariance = TRUE, 
  autocorResiduals = TRUE
)


# Determine required N in a 5-wave ARMA model
# to detect that the means in group 1
# differ from the means in group 2, where
# both groups are equal-sized
# with a power of 80% on alpha = 5%, where
# X is measured by 3 indicators loading by .5 each (at each wave and in each group), and
# the autoregressive effects are .5 at each wave and in both groups and
# the moving average parameters are .25 at each wave and in both groups and
# the variances are 1 at each wave and in both groups and 
# all are assumed to be constant across waves (in both the H0 and the H1 model) and
# invariance of variances, autoregressive effects, and moving average parameters 
# across groups as well as
# metric and scalar invariance (across both waves and groups) and
# autocorrelated residuals are assumed
powerARMA <- semPower.powerARMA(
  'a-priori', alpha = .05, power = .80, N = list(1, 1),
  nWaves = 5,
  autoregLag1 = list(
    c(.5, .5, .5, .5),   # group 1
    c(.5, .5, .5, .5)),  # group 2
  mvAvgLag1 = rep(.25, 4),
  variances = rep(1, 5),
  means = list(
    c(0, .1, .1, .1, .1),  # group 1
    c(0, .4, .4, .4, .4)   # group 2
  ),
  waveEqual = c('autoreg', 'var', 'mvavg', 'mean'),
  groupEqual = c('var', 'autoreg', 'mvavg'),
  nullEffect = 'meanA = meanB',
  nIndicator = rep(3, 5), loadM = .5,
  invariance = TRUE, 
  autocorResiduals = TRUE
)

# perform a simulated post-hoc power analysis
# with 250 replications
set.seed(300121)
powerARMA <- semPower.powerARMA(
  'post-hoc', alpha = .05, N = 500,
  nWaves = 5,
  autoregLag1 = c(.3, .7, .6, .3),
  mvAvgLag1 = rep(.3, 4),
  variances = rep(1, 5),
  waveEqual = c('mvAvg'),
  nullEffect = 'autoreg',
  nIndicator = rep(3, 5), loadM = .5,
  invariance = TRUE, 
  autocorResiduals = TRUE, 
  simulatedPower = TRUE,
  simOptions = list(nReplications = 250)
)

## End(Not run)

[Package semPower version 2.1.0 Index]