Announcement

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

  • 'predict' after runmlwin

    Hi Statalist,

    I am running a cross classified model using runmlwin. Previously, I had used meqrlogit and then I used the following code to predict fixed and random effects and to graph them:

    Code:
    predict v0*, reffects  
    predict v0se*, reffects 
    predict probAll
    predict pfx, xb 
     
    gen probPeriod = 1 /(1+exp(-1*(pfx + v01))) 
    gen probPrL = probPeriod-1.96*v0se1
    gen probPrU = probPeriod+1.96*v0se1
     
    collapse  (mean) probP = probPeriod (semean) probPs = probPeriod, by(Period)
    gen probPrL = probP-1.96*probPs
    gen probPrU = probP+1.96*probPs
     
    twoway (connected probP Period, mcolor(black) lcolor(black)) ///
    (connected probPrL Period, mcolor(black) lcolor(black) lpattern(dash)) ///
    (connected probPrU Period, mcolor(black) lcolor(black) lpattern(dash)), ///
    ytitle(Predicted probability with 95% confidence band) xtitle(Period) xlabel(#3) legend(off)


    In an attempt to predict and graph my results using runmlwin I tried the following code:
    Code:
    runmlwin ID cons, level2(Period:cons, , residuals(v)) level1(Cohort: cons, residuals(u)) discrete(dist(binomial) link(logit) denom(denom)) mcmc(cc) initsprevious nopause
    which returns error: invalid ’residuals’

    Would anyone be able to provide any insight into how to calculate this when using the runmlwin package? Thanks.


  • #2
    I have no experience with runmlwin, but - having installed it and reviewed the output of help runmlwin - it appears to me that
    Code:
    ... level2(Period:cons, , residuals(v)) ...
    contains one more comma than it should.

    Comment


    • #3
      Thank you for pointing that out William and taking the time to install and go through the helpfile. Having corrected the code (by including one comma) I receive a different error:

      "You cannot make covariates random at level 1 when using the binomial response distribution"

      Maybe someone has received a similar error and could shed light on what might be wrong with the code? Just to clarify I ran the following:

      Code:
      runmlwin ID cons, level2(Period:cons, residuals(v)) level1(Cohort: cons, residuals(u)) discrete(dist(binomial) link(logit) denom(denom)) mcmc(cc) initsprevious nopause

      Comment


      • #4
        In this case, runmlwin is fairly clear in its description of the problem.
        Code:
        ... level1(Cohort: cons, residuals(u)) ...
        specifies that at level 1 the covariate cons will have a random coefficient within groups defined by Cohort - that is, will have a random Cohort effect - and runmlwin tells you that it does not allow random effects at level 1 given your use of a binomial response distribution. And the Examples section (b) Discrete response models of the output of help runmlwin does not seem to show random effects at level 1. Is your understanding of the formulation of your model correct?

        Taking a step back, I'm pessimistic that your topic will attract the sort of reader that it needs to resolve this problem. It seems to me you have a three step process you are travelling.
        1. You have fit a model with meqrlogit and have not shown the command used to fit that model, so it is not possible to compare your successful merqlogit model to your unsuccessful runmlwin model.
        2. You now wish to fit a similar model using runmlwin but have not explained how you want the model to differ from the model fit with merqlogit. Are you trying to reproduce the results from merqlogit for comparison? Or are you trying to enhance them in some way, by taking advantage of capabilities not part of merqlogit? If I were doing this, I would first start by trying to reproduce the merqlogit results to test my understanding of runmlwin.
        3. Once you succeed in fitting your model with runmlwin, that is when you concern yourself with reproducing the post-estimation analysis you did with merqlogit.
        Yet the title of this topic refers to step 3, when you have yet to succeed in step 2.

        I suggest that, if reviewing and reflecting on the examples in the documentation does not lead to a solution, you post a new topic aimed at step 2, explaining what you are trying to accomplish and what your objective is in doing so. Include the merqlogit command you successfully used to accomplish step 1. Show the command that you are attempting to use. If possible, reference similar command in the Examples section (b) Discrete response models of the output of help runmlwin. And choose a title for your new topic that focuses on the problem you are having using runmlwin to fit your discrete response model.
        Last edited by William Lisowski; 05 Mar 2019, 10:13.

        Comment


        • #5
          Thank you William for your response. Yes, I realise my post may have not been as clear as it should be. I will reflect on the points you've made and make a more coherent post once i've also got a more solid understanding of runmlwin.

          Comment

          Working...
          X