Announcement

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

  • Obtaining standard error for covariance in mixed effect model

    Dear Statalist,

    I was wondering if anyone knows how I could obtain the standard error for the covariance between interaction effect and the group variable in mixed effect model for each individual prediction. Here are more details:

    I ran a mixed effect model mixed weight week||id:week,cov(unstructured)
    and i was able to obtain the standard errors for each prediction using
    predict m*, reffects reses(s*)

    However, I looked around and wasn't able to find a way to obtain the standard error for covariance (note that I have the covariance unstructured). would appreciate any help! Thanks for your time in advance.

  • #2
    Code:
    . mixed weight week || id: week, cov(unstructured)
    
    Performing EM optimization:
    
    Performing gradient-based optimization:
    
    Iteration 0:   log likelihood = -868.96185 
    Iteration 1:   log likelihood = -868.96185 
    
    Computing standard errors:
    
    Mixed-effects ML regression                     Number of obs     =        432
    Group variable: id                              Number of groups  =         48
    
                                                    Obs per group:
                                                                  min =          9
                                                                  avg =        9.0
                                                                  max =          9
    
                                                    Wald chi2(1)      =    4649.17
    Log likelihood = -868.96185                     Prob > chi2       =     0.0000
    
    ------------------------------------------------------------------------------
          weight |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
            week |   6.209896   .0910745    68.18   0.000     6.031393    6.388399
           _cons |   19.35561   .3996387    48.43   0.000     18.57234    20.13889
    ------------------------------------------------------------------------------
    
    ------------------------------------------------------------------------------
      Random-effects Parameters  |   Estimate   Std. Err.     [95% Conf. Interval]
    -----------------------------+------------------------------------------------
    id: Unstructured             |
                       var(week) |   .3715251   .0812957      .2419532    .5704859
                      var(_cons) |   6.823363   1.566194      4.351297    10.69986
                 cov(week,_cons) |  -.0984378   .2545767     -.5973991    .4005234
    -----------------------------+------------------------------------------------
                   var(Residual) |   1.596829    .123198      1.372735    1.857505
    ------------------------------------------------------------------------------
    LR test vs. linear model: chi2(3) = 764.58                Prob > chi2 = 0.0000
    
    Note: LR test is conservative and provided only for reference.

    Comment


    • #3
      Thanks so much for your response Clyde! So yes there is no problem in getting the standard error for the covariance estimate. However, I was hoping to get the covariance standard error for each individual observation through predict. So for the random effect standard error for each observation, we can do
      predict m*, reffects reses(s*)

      And it would output the standard errors for the standard error for each individual random effect and random interaction effect. But is there a way to get the individual level covariance standard error?

      Sorry if I am being unclear here.

      Comment


      • #4
        Oh, now your question is clear. I'm afraid I don't know the answer. I'm not even sure that it's a meaningful question to ask. If you think about the random slopes, model you can write it as an equation like this:

        Code:
        weightit = constant + b*weekt + ui + vi*weekt + eit, i ranging over pigs, t over time
        Each observation has individual values of weightit and week. The estimate of b is not a function of i or t: it is a characteristic of the entire data set. And ui is estimated as a common value for all observations pertaining to pig i, and eit is estimated for each observation. Those estimates have sampling distributions, and the standard deviation of that sampling distribution is the standard error for that parameter. Note, in particular that when you use -predict, reffects reses()-, the standard errors you get are not distinguishing observations. They are constant over observations having the same id.

        Now what about the covariance? Note that it is not a parameter in the model equation as written. Rather, it characterizes the relationships among the values of the ui and the vi. As such, these covariances do not describe attributes of observations or even of sets of observations characterized by a common id. They are attributes of the entire data corpus. So I do not think that there is any observation-level or set of observation-level standard error applicable to the covariance, as the covariance itself is not an attribute of any such level. The covariance is more like b: it is independent of i and t and a single value applies to the entire data set.
        Last edited by Clyde Schechter; 16 Feb 2020, 23:12.

        Comment

        Working...
        X