Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running a power analysis on a lavaan latent growth curve model

I am trying to conduct a power analysis using semTools on a latent growth curve model estimated using lavaan. See below:

library(RCurl)
library(lavaan)
library(semTools)
x <- getURL("https://gist.githubusercontent.com/aronlindberg/dfa0115f1d80b84ebd48b3ed52f9c5ac/raw/3abf0f280a948d6273a61a75415796cc103f20e7/growth_data.csv")
growth_data <- read.csv(text = x)

model_regressions <- ' i =~ 1*t1 + 1*t2 + 1*t3 + 1*t4 + 1*t5 + 1*t6 + 1*t7 + 1*t8 + 1*t9 + 1*t10 + 1*t11 + 1*t12 + 1*t13+ 1*t14 + 1*t15 + 1*t16 + 1*t17 + 1*t18 + 1*t19 + 1*t20
s =~ 0*t1 + 1*t2 + 2*t3 + 3*t4 + 4*t5 + 5*t6 + 6*t7 + 7*t8 + 8*t9 + 9*t10 + 10*t11 + 11*t12 + 12*t13 + 13*t14 + 14*t15 + 15*t16 + 16*t17 + 17*t18 + 18*t19 + 19*t20

# fixing error-variances
t8 ~~ 0.01*t8
t17 ~~ 0.01*t17
t18 ~~ 0.01*t18
# regressions
s ~ h_index
i ~ h_index'

SSpower(powerModel = model_regressions, popModel = model_regressions, n = c(87, 125), fun = "growth")

This, however, does not seem to work. My overall question is: how do I run a power analysis using semTools for a latent growth curve model estimated using lavaan? And more specifically, what should I use to specify powerModel and popModel?

like image 649
histelheim Avatar asked Apr 02 '20 16:04

histelheim


1 Answers

How do I run a power analysis using semTools for a latent growth curve model estimated using lavaan

SSpower from semTools should work.

And more specifically, what should I use to specify powerModel and popModel?

From the perspective of syntax, your model_regressions object seems to be valid lavaan object which you can pass to SSpower as powerModel argument, to describe the model to be analyzed, and also as popModel argument to specify the data-generating model. Nevertheless, you would also need to specify the alpha - Type I error rate, and nparam - number of invalid constraints in powerModel. Also, unless you are analyzing a multigroup model, and just trying to assess the power for two separate sample sizes, you could run the SSpower-command separately with n=87 and n=125. For example with n=87 the code would look like this:

  SSpower(powerModel = model_regressions, n = 87, nparam = 1, popModel = model_regressions,  fun = "growth", alpha=0.05)
    # [1] 0.05044634

NB: If you are trying to perform multigroup analysis, I am not sure this code would work in a correct manner. For multigroup analysis I would probably try another option suggested by the manual in which instead of using popModel, one would "..specify all non-zero parameters in a population model, ... by submitting a population covariance matrix (Sigma) and optional mean vector (mu) implied by the population model.". You can do this by stating mu and sigma within SSpower function call:

SSpower(...Sigma = , mu = , ...)
like image 66
Oka Avatar answered Nov 09 '22 03:11

Oka