Ok, thanks, that makes sense.
But can you tell if there is another problem with the code?
Because even when I try to just run the following code at the individual level
with the following code, I get an error message: "a not found" but as far as I
can tell I have properly specified all the variables.
Sorry for all the questions, but it is difficult learning a new program in
isolation!
-Rahsaan
sort council courts police
gen id=_n
expand 3
sort id
qui by id: gen response=_n
gen item1=response==council
gen item2=response==courts
gen item3=response==police
eq resp: item1 item2 item3
eq latent: muschri gentrust
gllamm response, i(id) eq(resp) geq(latent) link(ologit) f(binom)
Quoting Stas Kolenikov <[email protected]>:
> If you have three levels, then you would need more equations -- one
> for each level. That's where your error message comes from. How you
> want to incorporate other leves is up to you though -- as random
> effects, random slopes, whether they affect the lower levels latent
> variables -- pretty much any configuration might be defensible, just
> look at what makes sense for your problem and in your discipline.
>
> On 2/11/09, Rahsaan Maxwell <[email protected]> wrote:
> > Thanks, this definitely helps.
> >
> > Does it look like I have set it up correctly?
> >
> > Because I have two questions.
> >
> > 1) If I run the following code I get this error message, which I am not
> sure I
> > understand:
> >
> > 1 equations specified: response, need 2
> >
> > 2) Also, if I want to run a multilevel model with variables that analyze
> both
> > the individual and the neighborhood level, is it correct to include the
> > neighborhood grouping variable 'neighid' as I have done below?
> >
> > Thanks,
> >
> > -Rahsaan
> >
> > sort council courts police
> > gen id=_n
> > expand 3
> > sort id
> > qui by id: gen response=_n
> > gen item1=response==council
> > gen item2=response==courts
> > gen item3=response==police
> >
> >
> > eq response : item1 item2 item3
> >
> > eq latent : x1...x4
> > gllamm response, i(id neighid) eq(response) geq(latent) link(ologit)
> >
> >
> >
> >
> >
> >
> > Quoting Stas Kolenikov <[email protected]>:
> >
> > > You expand the data to create a single variable, let's call it
> > > -response-. For each original observation identified by variable
> > > called -id-, then you will need to create three dummy variables, say
> > > -item1-, -item2- and -item3-, to keep track of where that response
> > > came from. Then your model will essentially look like
> > >
> > > eq response : item1 item2 item3
> > > eq latent : all regressors for the latent variable
> > >
> > > gllamm response, id( id ) eq( response ) geq( latent ) link() family()
> > >
> > > The -eq- options says what is the pattern of the loadings of the
> > > latent variable on the observed ones, and -geq- says what is the
> > > structural model for that latent variable -- in your case, your
> > > regression.
> > >
> > > On 2/11/09, Rahsaan Maxwell <[email protected]> wrote:
> > > > Thanks for the response. I see that I need to expand the data but I'm
> not
> > > sure
> > > > how to then combine the three observed variables into one
> multivariate
> > > > response?
> > > >
> > > > From what I can tell, section 8.4 in the gllamm manual is the closest
> to
> > > my
> > > > situation but it looks like they are regressing y on the different
> items
> > > that
> > > > comprise the latent variable, whereas I want to be regressing the
> items of
> > > the
> > > > latent variable on other variables. Or is that a necessary first
> step to
> > > get
> > > > the factor loadings? In which case how do I define y? That doesn't
> seem
> > > to be
> > > > addressed in the manual.
> > > >
> > > > Thanks,
> > > >
> > > >
> > > > -Rahsaan
> > > >
> > > >
> > > > Quoting Mads Meier Jæger <[email protected]>:
> > > >
> > > > > Rahsaan,
> > > > >
> > > > > This can be done in gllamm by expanding the data so that the three
> > > observed
> > > > > variables (trust in police, etc.) form a multivariate response for
> each
> > > > > individual, and then by using a random effect to model the latent
> DV.
> > > You
> > > > > need to expand the data to "trick" gllamm into treating the three
> > > observed
> > > > > variables as a multivariate response, see chapter 4 and 8 in the
> gllamm
> > > > > manual. It should be easy enough also to include more random
> effects to
> > > > > account for additional multilevel (neighbourhood, etc.) clustering.
> You
> > > could
> > > > > also use eqs() to model covariate effects on the latent DV.
> > > > >
> > > > > Mads
> > > > >
> > > > >
> > > > >
> > > > > -----Oprindelig meddelelse-----
> > > > > Fra: [email protected]
> > > > > [mailto:[email protected]] På vegne af Rahsaan
> > > Maxwell
> > > > > Sendt: 11. februar 2009 06:49
> > > > > Til: [email protected]
> > > > > Emne: st: Latent variable DVs in gllamm
> > > > >
> > > > > Does anyone know if it is possible to build a multi-level mixed
> effects
> > > model
> > > > > with a latent DV using glamm?
> > > > >
> > > > > I have a unobserved response variable (political trust) that is
> > > comprised of
> > > > > three observed variables (trust in police, trust in government,
> trust in
> > > > > politicians). I am trying to run a multi-level model with fixed
> effects
> > > IVs
> > > > > at
> > > > > the individual and neighborhood level and a random intercept for
> the
> > > > > neighborhood grouping level.
> > > > >
> > > > > However, I cannot figure out how to construct the DV as a latent
> > > variable. I
> > > > > have been trying to use the eqs function but that does not seem to
> work.
> > > > >
> > > > > Thanks,
> > > > >
> > > > > -Rahsaan
> > > > >
> > > > >
> > > > > Rahsaan Maxwell, Ph.D.
> > > > > Assistant Professor
> > > > > Department of Political Science
> > > > > University of Massachusetts, Amherst
> > > > >
> > > > > Postdoctoral Fellow
> > > > > Transatlantic Academy
> > > > > German Marshall Fund of the United States
> > > > > http://rahsaanmaxwell.googlepages.com
> > > > > *
> > > > > * For searches and help try:
> > > > > * http://www.stata.com/help.cgi?search
> > > > > * http://www.stata.com/support/statalist/faq
> > > > > * http://www.ats.ucla.edu/stat/stata/
> > > > >
> > > > >
> > > > > *
> > > > > * For searches and help try:
> > > > > * http://www.stata.com/help.cgi?search
> > > > > * http://www.stata.com/support/statalist/faq
> > > > > * http://www.ats.ucla.edu/stat/stata/
> > > > >
> > > >
> > > >
> > > > Rahsaan Maxwell, Ph.D.
> > > > Assistant Professor
> > > > Department of Political Science
> > > > University of Massachusetts, Amherst
> > > >
> > > > Postdoctoral Fellow
> > > > Transatlantic Academy
> > > > German Marshall Fund of the United States
> > > > http://rahsaanmaxwell.googlepages.com
> > > > *
> > > > * For searches and help try:
> > > > * http://www.stata.com/help.cgi?search
> > > > * http://www.stata.com/support/statalist/faq
> > > > * http://www.ats.ucla.edu/stat/stata/
> > > >
> > >
> > >
> > > --
> > > Stas Kolenikov, also found at http://stas.kolenikov.name
> > > Small print: I use this email account for mailing lists only.
> > >
> > > *
> > > * For searches and help try:
> > > * http://www.stata.com/help.cgi?search
> > > * http://www.stata.com/support/statalist/faq
> > > * http://www.ats.ucla.edu/stat/stata/
> > >
> >
> >
> > Rahsaan Maxwell, Ph.D.
> > Assistant Professor
> > Department of Political Science
> > University of Massachusetts, Amherst
> >
> > Postdoctoral Fellow
> > Transatlantic Academy
> > German Marshall Fund of the United States
> > http://rahsaanmaxwell.googlepages.com
> > *
> > * For searches and help try:
> > * http://www.stata.com/help.cgi?search
> > * http://www.stata.com/support/statalist/faq
> > * http://www.ats.ucla.edu/stat/stata/
> >
>
>
> --
> Stas Kolenikov, also found at http://stas.kolenikov.name
> Small print: I use this email account for mailing lists only.
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
>
Rahsaan Maxwell, Ph.D.
Assistant Professor
Department of Political Science
University of Massachusetts, Amherst
Postdoctoral Fellow
Transatlantic Academy
German Marshall Fund of the United States
http://rahsaanmaxwell.googlepages.com
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/