Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    When presenting an error message (and just about anything else) it is best to show the exact syntax that was actually used. If you really do have something like " i.myStratumVariable" then I think it doesn't like the i. because that is for factor variable notation and I don't think gllamm supports that. You either need to create your own dummies; or maybe you can use -xi-.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #17
      Jane: Stata error message is coming from the use of i.variable syntax, and as Richard indicated you need to prefix gllamm with xi:. Also, gllamm deals with pweights differently, namely via the pweight() option. I would encourage you to read on gllamm, as you cannot learn it and make it work from a single forum message.

      Richard, Stephen: the issue of weights in longitudinal models is complicated, and it's a lack of both methodological guidance and computational clarity. Stata reasonably expects the weights to be constant, as the (quasi-)likelihoods of the xt models are computed at the panel level (ml d0/ml d2 estimator, if you like). In other words, the 10 years of longitudinal data on Stas Kolenikov are aggregated into a single number, and Stata very much prefers not having to guess how to weights that contribution in the overall likelihood. If weights are constant within the panel, the issue does not arise: you just apply whatever weight you see attached to every entry in the panel. If they are not, then absent of better guidance on substantive grounds of sample design that could come from (currently nonexisting) option of say xtreg, it is entirely unclear which weight should be used (the first one? the last one? average of the weights? geometric average of the weights? total of the weights? anything else?). Stephen has a luxury of being able to knock on Chris Skinner's door to figure out the best way of going about this, as Prof. Skinner of LSE is world's leading expert on weights with longitudinal data, with some 10-15 years of research record on the topic and top publications on it.

      Some steps towards incorporating varying weights have been taken by mixed, which economists might be able to recognize as the random effects panel data estimator. (Stata 14 wish from Stas Kolenikov: extensions of the varying weights to meglm!).
      -- Stas Kolenikov || http://stas.kolenikov.name
      -- Principal Survey Scientist, Abt SRBI
      -- Opinions stated in this post are mine only

      Comment


      • #18
        Dear Statalist friends,

        I am sorry that I might have brought up some confusion for my most recent post. The "Y" in the Y*Tx is not the dependent variable Y. What I meant in Y*Tx was Year (2000=0; 2003=1) * Treatment (control group=0; intervention group=1). This coefficient of this interaction term in the panel orderderd logistic regression can be used to interpret the magnitude of the effect for difference-in-difference. Thanks a lot.

        Best wishes,
        Jane

        Comment


        • #19
          Jane: one other lesson to take away is that you should post exactly what you typed and exactly what Stata returned (and, preferably, do so using the CODE delimiter feature in the advanced editor accessible from the posting area -- click on the "A"). That way, we would have been less confused by your notation, and also things would be more legible. Three of us have now mentioned problems with your use of the "i." prefix, so please address that issue when you report back.
          Last edited by Stephen Jenkins; 14 Jul 2014, 01:32.

          Comment


          • #20
            Dear Statalist Friends,

            Thanks so much again for posting such great discussions. I actually have been studying gllamm manual (140 page PDF) and its weblink for a long while. My only hope is to combine what I've learned from the manual and Stas' sample code to make things work. My case is just a pre- and post- study design and I am not sure why I need to study mixed command since I have only 2 time points of the measurement. According to what I've learned and suggestions from you guys, I am guessing that I have to make the following changes from Stas' code:

            (1) I have to use 2 parameters within the pweight option (i.e., pweight(pw1 pw2) )

            (2) I have to use xi: gllamm... instead of gllamm...

            (3) I have to figure out how gllamm may produce odds ratio ("gllamm, eform" did not work!!)

            Therefore, here is what I did:
            Code:
            gen pw1 = 1
            gen pw2 = myPweightVariable
            
            xi: gllamm Y Year Treatment _interaction_Year_Tx age gender x3 x4 i.myStratumVariable, i(ID) family(binomial) link(ologit) cluster(myPSUvariable) pweight(pw1 pw2)

            The new error message is:
            HTML Code:
            i.myStratumVariable        _ImyStratumVariable_1-52     (naturally coded; _ImyStratumVariable 1 omitted)
            probability weight variables not found
            r(111);

            Extra notes: 51 new variables were created. They are _ImyStratumVariable_2, ..., _ImyStratumVariable_51.



            I hope we are few steps closer to get things going. Thank you all for your patience and kindness.

            Many thanks,
            Jane



            Originally posted by skolenik View Post

            Going back to Jane's original question, I would run this model using gllamm that supports multilevel weights. Jane, however, would need to figure out how to scale her weights, which is touched upon in Stata 13 mixed command (see help mixed##scale_method); and how to translate her sampling design into the appropriate scale of weights. She would also have to lose stratification. So in the end, she will have something like

            Code:
            egen pw2 = mean( myPweightVariable / number_of_level1_units_in_a_given_level2_unit ), by(ID)
            gen pw1 = myPweightVariable / pw1
            gllamm Y Year Treatment Y*Tx age gender x3 x4 i.myStratumVariable, i(ID) family(binomial) link(ologit) cluster(myPSUvariable) pweight(pw)
            The first two lines assume a simple random sample of the level 1 units within a level 2 unit. If Jane's level 1 units are repeated observations over the same individual, then something like

            Code:
            gen pw1 = 1
            gen pw2 = myPweightVariable
            will be more appropriate. She will have to carefully figure out what to do here.

            HTH.
            Last edited by Jane Adams; 14 Jul 2014, 10:39.

            Comment


            • #21
              What you supply in the pweight() option of gllamm is a prefix, not a variable list. That's why I wrote it the way I wrote it, and that's why you are getting an error message about the pweights. Once again, keep reading the manual and may be the books on gllamm.
              -- Stas Kolenikov || http://stas.kolenikov.name
              -- Principal Survey Scientist, Abt SRBI
              -- Opinions stated in this post are mine only

              Comment


              • #22
                Dear Statalist friends,

                Thank you all very much for your help. I'll keep studying gllamm and figuring things out.

                Best,
                Jane

                Comment


                • #23
                  Hello Stata users,

                  I have read your previous posts but I want to be sure that I understand your discussion about the weights.
                  In my database each individual is interviewed in three waves, with different weights across waves. Thus, the same individual has different weights for each years. I estimate a xtprobit :
                  Code:
                  xtprobit actifocc $xvar [iweight=pondef]
                  So Stata returns this message :
                  Code:
                  weight must be constant within id
                  r(199);
                  I don't understand why it's not possible to allowing for different weights.
                  Skolenik says
                  If weights are constant within the panel, the issue does not arise: you just apply whatever weight you see attached to every entry in the panel. If they are not, then absent of better guidance on substantive grounds of sample design that could come from (currently nonexisting) option of say xtreg, it is entirely unclear which weight should be used (the first one? the last one? average of the weights? geometric average of the weights? total of the weights? anything else?)
                  Have you a suggestion on the better thing to do ?

                  Thank.
                  Last edited by Flayols Alexandra; 07 Nov 2014, 10:20.

                  Comment

                  Working...
                  X