Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: confirmatory factor analysis using gllam in stata

From   "Hong, Sounman" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: confirmatory factor analysis using gllam in stata
Date   Sun, 16 Jan 2011 22:10:59 -0500

My question build upon a previous Q&A. I found a question that is fundamentally the same as mine. But I cannot understand the posted answer. 

Let's first look at the question and answer.

This is the question. 

> Hi all,

> I have a scale composed of 15 variables (items in a 5-point likert scale) that correspond to 3 factors/domains. How do I run CFA using gllamm. 

> My data:

> Suppose the variable names are x1-x15 and the factors are f1 f2 and f3.

> f1 corresponds to variables x1-x5
> f2 corresponds to variables x6-x10
> f2 corresponds to variables x11-x15

> I tried using the eq syntax to define the factors (equations) using the following syntax:

> eq f1: x1-x5
> eq f2: x6-x10
> eq f3: x11-x15

> but where do I go from here? I'll not even post all my attempts.

> Any ideas?
This is the answer posted for the question
If that's a linear model, then first you need to -reshape-
your data so that each variable is now an observation within a block
corresponding to one unit:

g long ID = _n
reshape long x, i(ID)

Then you need to link your factors to your variables (which are now

bysort ID: g byte d1 = _n<6
by ID: g byte d2 = (_n>5) & (_n<11)
by ID: g byte d3 = _n > 10
g byte ones = 1

Now define your equations:

eq 101 : ones d1 d2 d3
eq 102 : ones d1 d2 d3
eq 103 : ones d1 d2 d3

Now you are ready to run -gllamm-:
gllamm x, i(id) eqs(101 102 103) nrf(3)
So, my question is that I don't understand the "eq" commands in the answer above. 
It seems like the answer defines three equations with 3 factor variables and the variable "ones". But why?
I was thinking the following.

eq factor1 : d1
eq factor2 : d2
eq factor 3: d3
gllamm x, i(id) eqs(d1 d2 d3) nrf(3)

Is there anything wrong with my stata codes?? 
What is the difference between my command and the answer posted above? 
How should I change it?
Any idea? Any reply would be greatly appreciated. 
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index