Announcement

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

  • Variance & Covarance multilevel logit estimation

    Dear All,

    I estimate a multilevel logit model using melogit. The result is reported below:

    Click image for larger version

Name:	result.png
Views:	1
Size:	48.8 KB
ID:	1474663


    I would like to save var(centeraf), var(_cons) and cov(centeraf,_cons) such that I can use them to plot the total variance of the model using:

    Code:
    twoway function var(_cons) + covar(centeraf, _cons)*centeraf + var(centeraf)*centeraf^2, range (-10 10)

    I think I have seen sometimes ago how I can save them (maybe using scalar) but I cannot remember where I saw it.

    Since I am estimating more models, I would like to save those element after each estimation rather than imputing them manually every time.

    Any help would be appreciated.

    Thanks in advance,

    Dario

  • #2
    I partially solved using:

    Code:
    matrix b=e(b)
    scalar var_con=b[1,8]
    di var_con
    However, since the models do not necessarily contain the same set of regressors, I should manually count the position of the coefficients in the row matrix.

    I tried to overcome this using

    Code:
    matrix list e(b)
    display _b[var(_cons[S003])]
    display _b[_cons[S003])]
    display _var(_cons[S003])
    display var(_cons[S003])


    However none of them works.

    Comment


    • #3
      Eventually, I found the way to display the variance looking at the ado file in meglm_estat

      Code:
      display _b[/var(_cons[S003])]

      Comment

      Working...
      X