Announcement

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

  • Diagnostic tests for correlated random effects model

    Hi,

    What diagnostic tests can be done on a correlated random effects model? And if so how do I code this in Stata? I am using panel data and there are time-varying and time-invariant variables in my model.

    Many thanks,
    Riaz

  • #2
    Maybe something like the following for one example?
    Code:
    version 15.1
    
    clear *
    
    set seed `=strreverse("1495719")'
    
    quietly drawnorm intercept slope, double corr(1 -0.5 \ -0.5 1) n(200)
    generate int pid = _n
    
    quietly expand 5
    bysort pid: generate byte tim = _n
    generate byte trt = mod(_n, 2)
    
    generate double rsp = intercept + ((tim - 3) / 2 / 10) * (1 + slope) + rnormal(0, sqrt(0.5))
    
    mixed rsp i.trt c.tim || pid: tim, covariance(unstructured) nolrtest nolog
    
    *
    * Begin here
    *
    predict double fitted, fitted
    predict double residuals, residuals
    graph twoway scatter residuals fitted, mcolor(black) msize(vsmall) ///
        xlabel(-3(1)3) ///
        ylabel(-3(1)3, angle(horizontal) nogrid) yline(0, lcolor(black) lpattern(dash))
    
    exit
    Maybe out-of-sample predictions for the fixed effects for another?

    What is it that you hope to diagnose?

    Comment


    • #3
      Thank you for that Joseph, though I am not sure it is exactly what I need. I am trying to diagnose if the correlated random effects model that I have used is a good fit for my data. For example with a fixed effects model you can run an F-test to see if variables are jointly significant, is there such a thing for a CRM model. Sorry I am not so knowledgeable with econometric theory so maybe I haven't explained this well!

      Many thanks,
      Riaz

      Comment


      • #4
        See also
        Schunck R. 2013. Within and between estimates in random-effects models: Advantages and drawbacks of correlated random effects and hybrid models. Stata Journal 13(1): 65-76.
        Schunck R, Perales F. 2017. Within- and between-cluster effects in generalized linear mixed models: A discussion of approaches and the xthybrid command. Stata Journal 17(1): 89115.

        Comment

        Working...
        X