# RE: st: CFA using gllamm

 From "Diego Bassani" <[email protected]> To <[email protected]> Subject RE: st: CFA using gllamm Date Fri, 7 Apr 2006 09:55:09 -0400

Thanks a lot! I was working on making addendums to your cfa1.ado but your solution seems much less time consuming. Will try it and let you know.
Thanks
Diego

btw: it's linear, yes.

-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of Stas Kolenikov
Sent: April 6, 2006 5:30 PM
To: [email protected]
Subject: Re: st: CFA using gllamm

well if you are not posting it, we don't even know what model you want
to fit! 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
observations):

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)

I think this should get you started, and my gut feeling would be it is
the syntax that's going to work for you. But no warranties; and it
won't give you the beloved fit indices, not even the overall chi2 fit;
you would need to construct the likelihood ratio from scratch.

Even though simple, this model may take a while for -gllamm- to figure
out. You might be better off writing your own likelihood program -- I
did that for my toy CFA with a single factor, and I will expand it
eventually to several factors, but it may take me a few months before
my research really calls for that.

On 4/6/06, Diego Bassani <[email protected]> wrote:
> 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. Sophia, who developed gllamm, suggested it could be used for CFA in the statalist but was not specific and I am struggling to define the factors and run the analysis. I've read gllamm's manual, but still could not figure out how to do it.
>
> 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?
>
> Diego
>
> Diego G. Bassani, M.Sc., Ph.D.

--
Stas Kolenikov
http://stas.kolenikov.name

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/