Announcement

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

  • "not sorted" after predict u command on panel frontier model

    Hi, I am developing a frontier model but am unable to predict inefficiency and efficiency values. Below I've copied my instructions:

    . xtfrontier frlabreg edu gdppcavg d.act year, ti

    [results ommitted for simplicity]

    . sort countrynum

    . predict fcastti, xb
    (36 missing values generated)

    . predict inefti, u
    not sorted
    r(5);


    Can you help?
    Many thanks


  • #2
    Welcome to Statalist.

    The xt commands generally expect the data to be sorted by both the panel variable and the time variable, when a time variable is used, as in your case for xtfrontier, ti. That isn't the case for predict, xb after xtfrontier, which is why that command didn't fail, but it is the case for predict, u which is why you got the error message you did.

    I don't know why you chose to sort your data after xtfrontier but before predict , but if you need your data sorted in that manner, you should do it after the predict commands (and any other postestimation commands you will be using). However, I would expect you would want to sort by both your panel and time variables, and actually, would expect it to already be sorted in that order as a consequence of your initial xtset command.
    Last edited by William Lisowski; 23 Mar 2020, 07:21.

    Comment


    • #3
      Thanks, but i have tried to sort at the very beginning. I don't understand how you would do after postestimation though
      I get the same mistake - see below


      use "C:\Users\inesc\Dropbox\Doutoramento polĂ­tica\Modelo\model1.dta"

      . sort countrynum year

      . xtfrontier frlabreg edu gdppcavg d.act year, ti

      [results omitted]

      . predict predti, xb
      (36 missing values generated)

      . predict inefti, u
      not sorted
      r(5);

      Thanks in advance


      Comment


      • #4
        It appears that the problem is due to the differenced term d.act in your model. At least, I was able to reproduce your problem using Stata's example data for xtfrontier, and work around it by manually calculating the differenced variable. The xtfrontier results are the same, but I cannot tell if the variable created by the predict, u command is correct.
        Code:
        webuse xtfrontier1, clear
        xtset
        xtfrontier lnwidgets lnmachines d.lnworkers, ti
        capture noisily predict predti, xb
        capture noisily predict inefti, u
        generate d_lnworkers = d.lnworkers
        xtfrontier lnwidgets lnmachines d_lnworkers, ti
        capture noisily predict predti2, xb
        capture noisily predict inefti2 , u
        My advice to you is to reproduce what I have done, using the data and code shown above, and then contact Stata Technical Services and describe the problem, and ask if the results produced with the manual differencing are indeed correct.
        Last edited by William Lisowski; 23 Mar 2020, 09:36.

        Comment


        • #5
          Thanks, but now I get zeros! will try technical services. Thanks for your help anyway

          Comment

          Working...
          X