Announcement

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

  • residual diagnostics using mixed

    Dear all,

    I'm having some problems with the residual diagnostics of my multilevel model in Stata (using mixed). I've read all the previous threads on that topic here on Statalist but I'm still not sure whether I'm doing it correctly.

    The main assumptions to check after running a mixed model (with my model being a random-intercept model with two levels, employees nested within firms) in my opinion are the normality of level-1 and level-2 residuals and homoscedasticity of level-1 residuals. I do have some questions regarding independence of level-1 and level-2 residuals, multicollinearity and linearity between predictors and the dependent variable as well.
    I'd be more than thankful if you could tell me whether my approach would yield the results I'm looking for.

    Code:
    mixed ...
    predict res, residuals
    predict rstand, rstandard
    predict rfit, fitted
    predict res2, reffects
    Normality
    Code:
    //normality of level-1 residuals
    histogram rstand, normal
    qnorm rstand
    pnorm rstand
    //normality of level-2 residuals
    histogram res2, normal
    qnorm res2
    pnorm res2
    Homoscedasticity
    Code:
    //homoscedastictiy of level-1 residuals
    twoway(scatter rstand rfit), yline(0)
    or is it supposed to be
    Code:
    twoway(scatter res rfit), yline(0)
    And regarding homoscedasticity, what would some kind of rhombus-shaped graph imply? It's not fan-shaped (which would indicate heteroscedasticity) but the variance is still not the same at all points along the yline.

    Independence of level-1 residuals and level-2 residuals
    I've also read that level-1 residuals and level-2 residuals are supposed to be independent of each other. Would it be enough to check the correlation between them using the following code?:
    Code:
    pwcorr res res2
    Multicollinearity
    I'm testing for multicollinearity using
    Code:
    estat vif
    after regress, is that even correct considering the fact that the variance inflation factor relies on the R-squared which is not really interpretable in multilevel modeling? Are there any other methods except for checking the correlations between the independent variables?

    Linearity between the dependent variable and independent variables
    I'm checking the linearity between the dependent variable and each of the independent variables (main predictors and control variables) using the following code:
    Code:
    acprplot depvar indepvar, lowess lsopts(bdwith(1))
    Or do I only have to check the linearity between my main predictors and the dependent variable?


    Thank you so much in advance, your input will be greatly appreciated!

    Felicia

  • #2
    Hi Felicia,

    This is a long shot, as your post is over two years old, but:

    I am looking into residual diagnostics for multilevel mixed-effects linear models I am estimating, and I was wondering if you had any insights on the following based your own readings on the subject. In all of my models, the predicted level 1 and level 2 residuals appear to be positively correlated (using lowess). I thought it indicated misspecification, but I ran a few simulations (example below) and the same happens with a model known to be correctly specified.

    Code:
    matrix input C = (1,0\0,1)
    capture program drop simixed
    program define simixed, rclass
        args n1 n2
        clear
        set obs `n1'
        generate i = _n
        drawnorm x1 x2 u_i
        expand `n2'
        bysort i: generate t = _n
        generate e_it = rnormal()
        correlate u_i e_it
        return scalar rho_obs = r(rho)    
        mvtest correlations u_i e_it, equals(C)
        return scalar reject_obs = r(p_chi2) < .05    
        generate y = 2 * x1 + 3 * x2 + u_i + e_it
        mixed y x1 x2 || i:
        predict uhat, reffects
        predict ehat, residuals
        predict sehat, rstandard
        correlate uhat ehat
        return scalar rho_hat = r(rho)
        mvtest correlations uhat ehat, equals(C)
        return scalar reject_hat = r(p_chi2) < .05
        correlate uhat sehat
        return scalar rho_hat_std = r(rho)
        mvtest correlations uhat sehat, equals(C)
        return scalar reject_hat_std = r(p_chi2) < .05
    end
    simulate rho_obs = r(rho_obs) reject_obs = r(reject_obs) rho_hat = r(rho_hat) reject_hat = r(reject_hat) rho_hat_std = r(rho_hat_std) reject_hat_std = r(reject_hat_std), reps(1000): simixed 200 30
    summarize rho_obs reject_obs rho_hat reject_hat rho_hat_std reject_hat_std, sep(2)

    Comment


    • #3
      Hi there,

      I have the same question as Felicia. How do I check the model assumptions after using mixed to fit a linear mixed-effects model? I had a look at help mixed postestimation and predict but could not find any examples for how to check the assumption of normality of residuals and homoscedasticity.

      Comment

      Working...
      X