Announcement

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

  • mestreg - How to change covariance structure

    Greetings!!
    I'm John, currently working on multilevel survival analysis using mestreg command.. I wanted to change the covariance structure through variance option but i'm getting an error stating that variable unstructured not available.
    Please guide me how to create the covariance vartype and incorporate it in the model.

    the code i used
    mestreg age ib2.ASEX ib1.Intact_RGrain || Region:,variance(unstructured) distribution(lognormal)

    Thanks in advance!!

  • #2
    I think you have the wrong name for the option: it's -covariance(unstructured)-. And -mestreg- does support unstructured covariance estimation.

    Comment


    • #3
      Thanks a lot sir.. It worked now..
      And can you pls guide me in doing random slope multilevel model?

      Comment


      • #4
        And can you pls guide me in doing random slope multilevel model?
        That is too vague and broad a question to possibly answer. If you have specific issues as you work on this, do post back with those questions.

        Comment


        • #5
          Dear sir,
          Below is my code for random intercept model with CENTID as cluster variable.
          mestreg age ib2.ASEX ib1.Refined_grain ib1.Region || CENTID:,covariance(unstructured) distribution(lognormal)

          now i wanted to add random slope for "Region" variable. How i could incorporate it?

          Thanks in advance!!

          Comment


          • #6
            If you are using version 17
            [code]
            mestreg age ib2.ASEX ib1.Refined_grain ib1.Region || CENTID: i.Region,covariance(unstructured) distribution(lognormal)
            [code]

            If you are using an older version of Stata, this simple syntax is not available to you. Earlier versions of Stata did not support factor variable notation in the random effects part of the mixed model commands. You would have to create your own separate indicator variables for the regions and include them, without using factor variable notation in both the fixed and random levels of the model. Earlier versions of Stata did not support factor variable notation in the random effects part of the mixed model commands.

            Now, I understand the temptation to relax as many constraints as possible, especially if they are not verifiable. But be aware that this model is at risk of blowing up. The unstructured covariance model will now expand to include estimates of covariance among the various random slopes for the different regions as well as the intercepts--the number of covariances to be estimated is therefore of order of the square of the number of regions. If the number of regions is small, that won't matter much. But if you have a large number of regions, you may find yourself blowing through memory limits. Or just taking a very long time--especially if some of those regions have only a small number of observations (which makes the likelihood fairly flat near the maximum so that convergence is slow). So before you launch down this pathway, ask yourself whether achieving your research goals really necessitates allowing the slopes for the regions to vary by CENTID, and whether you really need an unstructured covariance matrix. You are placing enormous demands on both memory and CPU time when you do this, and, at least in my experience, the covariance estimates are typically ignored anyway (they are usually considered nuisance parameters), and the random slopes may or may not really be important depending on your research goals. So, if it makes sense, go ahead and good luck. But don't go down this road unless you really need to.

            Comment


            • #7
              Thanks so much sir for your detailed response and explanation which is very easy to understand.
              I will try with other covariance structures and my region has six levels with good samples within each levels.
              I'm using STATA 16 and while using mestreg , hazard ratios are not reported. How to get Hazrad ratio instead of coefficients sir?

              Thanks in advance!!

              Comment


              • #8
                You can't get hazard ratios for the lognormal distribution model: it is parameterized as an accelerated failure time model. To my knowledge a proportional hazard estimator for the lognormal survivor function has not been developed. If you exponentiate the coefficients, you will get time ratios. For example a time ratio of 2 means that on average it takes twice as long to fail for each unit increase in the variable whose coefficient you exponentiated. (Note that this works in the opposite direction from hazard ratios, where a hazard ratio > 1 means a more rapid failure.)

                Comment


                • #9
                  It was great help sir.
                  Thanks so much for spending time and explaining the concepts.

                  Comment

                  Working...
                  X