3
$\begingroup$

I need to determine both the

  • number of free parameters to estimate and
  • degrees of freedom

of a structural equation model. I know how to calculate these values by hand. However, the model is rather big and I would prefer to use software for this.

Does anyone know how to obtain both values?

I am currently using the R package, lavaan. However, the model is so large that it takes an eternity to estimate. So I would like to avoid this.

I then tried to obtain the lavaan output by limiting the number of iterations to 1: control=list(iter.max=1). However, lavaan reports it doesn't converge (what a surprise) and only outputs NAs.

So is there any way around either calculating those values by hand (which is error prone) or by estimating the model?


Here is the model:

mTotal  <- 'a =~ a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + a10
            b =~ b1 + b2 + b3 + b4 + b5 + b6 + b7 + b8 + b9 + b10
            c =~ c1 + c2 + c3 + c4 c5 + c6 + c7 + c8 + c9 + c10
            d =~ d1 + d2 + d3 + d4 + d5
            e =~ e1 + e2 + e3 + e4 + e5
            f =~ f1 + f2 + f3 + f4 + f5
            g =~ g1 +g2 + g3 + g4 + g5
            h =~ h1 + h2 + h3 + h4 + h5 
            i =~ i1 + i2 + i3 + i4 + i5 + i6
            j =~ j1 + j2 + j3 + j4 + j5 + j6
            k =~ k1 + k2 + k3 + k4 + k5 + k6
            l =~ l1 + l2 + l3 + l4 + l5
            m =~ m1 + m2 + m3 + m4 + m5
            n =~ n1 + n2 + n3 + n4 + n5 + n6 + n7 + n9
            o =~ o1 + o2 + o3 + o4 + o5
            p =~ p1 + p2 + p3
            q =~ q1 + q2 + q3 + q4 + q5 + q6
            r =~ r1 + r2 + r3 + r4 + r5 + r6
            s =~ s1 + s2 + s3 + s4 + s5 + s6 + s8 + s9
            t =~ t1 + t2 + t3 + t4'

mTotal.fit <- cfa(mTotal, 
                  data = dataset, 
                  estimator = "ML",
                  control=list(iter.max=1)) 
$\endgroup$
2
  • $\begingroup$ I find it's more error prone to specify the model. :) Counting by hand is how I check I got the model correct (because of Lavaan defaults, which can trick me). Can you post your code? $\endgroup$ Commented Jun 23, 2016 at 16:37
  • $\begingroup$ Hehe, that's a change in perspective ;). I edited my original post and included the model. $\endgroup$
    – phx
    Commented Jun 23, 2016 at 17:09

1 Answer 1

5
$\begingroup$

I don't think it's hard to count the df for that model.

You have 125 variables. (!!!) So you have $k(k+1)/2 = 7875$ moments in the distribution.

You're estimating: 125 error variances, 125 loadings, and the covariances of the latent variables. You have 20 latent variables, so you have 190 covariances. That makes $125 + 125 + 190 = 440$ parameters to estimate, so:

$ df = 7875 - 440 = 7435$ (Assuming I counted everything correctly.)

It's a heck of a model. What's your sample size? I'll be impressed (by Lavaan) if that converges.

$\endgroup$
5
  • $\begingroup$ Just a short answer since I have to go in a sec: Thanks. However, it should be 125 - 20 factor loadings, since for each latent factor one factor loading has to be constrained to 1, right? $\endgroup$
    – phx
    Commented Jun 23, 2016 at 18:53
  • 3
    $\begingroup$ Yes, that's technically correct (best kind of correct). However, you'd then need to fix the variances of the latent variables in order to identify them, and that would give you 20 more, so it would work out to be the same. $\endgroup$ Commented Jun 23, 2016 at 18:55
  • $\begingroup$ Yeah, I get the same results as you. However, did you mean "free the variances of the latent variables"? To my understanding it works as such: I constrain on factor loading for each latent variable to 1 and therefore can freely estimate the variance of the latent variables. But maybe I misunderstood the term "fix" in your comment. Thanks nevertheless! $\endgroup$
    – phx
    Commented Jun 24, 2016 at 7:21
  • 1
    $\begingroup$ Btw: At the moment, I am still unwilling to accept your answer. I explicitly asked for a computer-based solution. Your answer is completely correct, though :). Just to let you know. $\endgroup$
    – phx
    Commented Jun 24, 2016 at 7:27
  • 1
    $\begingroup$ Lavaan uses some defaults for how to fix and free things. It fixes the first loading to 1, and frees the variance of the latent. So what you have might be written as: a ~= 1 * a1 + a2 ...; a ~~ a. You could also write: a ~= NA * a1 + a2 ...; a ~~ 1 * a. In the first, you identify the variance of the latent using the first variable, in the second you identify the variance by constraining it to 1. The models are equivalent. It's explained here: lavaan.ugent.be/tutorial/syntax2.html $\endgroup$ Commented Jun 24, 2016 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.