Announcement

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

  • estimate store for xtprobit

    hello guys,

    I am using stata12 and I have a question regarding the estimate store for a xtprobit model-- The error i get is the following factor variables and time-series operators not allowed. I use eststo: xtprobit export lntfp lagtfp age age2 i.size foreign sector,re

    I am using the same command for another country and it works perfectly. When i use the same command but without eststo, it works fine as well.

    here below is my code:

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(export lntfp lagtfp age age size) byte foreign float sector
    0   11.2033  10.48703  2.397895  2.397895 2 0 0
    0 11.918948   11.2033  2.484907  2.484907 2 0 0
    0 11.541365 11.918948 2.6390574 2.6390574 1 0 0
    0 11.227786 11.541365  2.772589  2.772589 1 0 0
    0 10.396968  10.94369  2.772589  2.772589 1 0 0
    1  11.07301 11.227786  2.484907  2.484907 1 0 0
    1 11.283434  11.07301  2.564949  2.564949 1 0 0
    1  10.94369 11.283434   2.70805   2.70805 1 0 0
    0  11.47068 10.396968  2.397895  2.397895 1 0 0
    0 11.795977  11.47068  2.484907  2.484907 1 0 0
    0  11.52371 11.795977  2.564949  2.564949 1 0 0
    0  11.82728  11.52371   2.70805   2.70805 1 0 0
    0 11.811805 12.481252  2.833213  2.833213 2 1 0
    1 11.440876  11.82728  2.397895  2.397895 1 1 0
    1  11.63074 11.440876  2.484907  2.484907 1 1 0
    1  11.55805  11.63074   2.70805   2.70805 1 1 0
    1 12.481252  11.55805  2.772589  2.772589 1 1 0
    0 11.034223 11.811805  2.484907  2.484907 1 0 .
    0 10.986166 11.034223  2.564949  2.564949 1 0 .
    0  10.97745 10.986166 2.6390574 2.6390574 1 0 .
    0 11.538152  10.97745   2.70805   2.70805 1 0 .
    0 11.088998 11.538152  2.833213  2.833213 1 0 .
    0 11.150767 11.088998  2.890372  2.890372 1 0 .
    0 11.216035 11.150767  2.944439  2.944439 1 0 .
    0 11.091298 11.216035  2.995732  2.995732 1 0 .
    0 10.623926 11.091298  2.397895  2.397895 1 0 0
    0 10.876317 10.623926  2.484907  2.484907 1 0 0
    0 10.819428 10.876317  2.564949  2.564949 2 0 0
    0  10.94681 10.819428 2.6390574 2.6390574 1 0 0
    0 11.030872  10.94681   2.70805   2.70805 1 0 0
    0 10.100516 11.030872  2.772589  2.772589 1 0 0
    end
    label values export cat_export
    label def cat_export 0 "Non-exporting", modify
    label def cat_export 1 "Exporting", modify
    label values size cat_size
    label def cat_size 1 "Micro", modify
    label def cat_size 2 "Small", modify
    label values foreign foreign1
    label def foreign1 0 "Domestic firm", modify
    label def foreign1 1 "Foreign firm", modify
    label values sector cat_sector
    label def cat_sector 0 "Service", modify
    what do you think is the problem?
    Thanks in advance
    Last edited by Klodi Gjini; 23 May 2019, 13:57.

  • #2
    There are a couple of problems with what you posted. age is in the varlist twice, while age2 is not. More importantly, you do not say how to xtset the file, and you do not seem to have included the vars that are needed to do so. Using dataex is great, but make sure you include the variables and code needed to reproduce the problem. If you post cleaned up code we can try to reproduce (and hopefully solve) the problem.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Thank you Richard for your reply.. Using stata12 i xtset the panel by firm and year. I probably made a mistake in the varlist, but one var should be age and the other age2. Here below I am reposting the code. the command i use is xtset firm year, and then when i do eststo: xtprobit export lntfp lagtfp age age2 i.size sector foreign,re i get the error: factor variables and time-series operators not allowed. The problem occurs only when i do the estimate store ( when i just run the xtprobit with RE it works fine).

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input float firm int year float(export lntfp lagtfp age age2 size) byte foreign float sector
      10 2008 0 11.133475 11.216705  2.772589 7.687248 2 0 .
      10 2009 0 11.069064 11.133475  2.833213 8.027098 2 0 .
      10 2010 0  9.815069 11.069064  2.890372 8.354249 2 0 .
      10 2011 0 10.364053  9.815069  2.944439 8.669721 2 0 .
      11 2005 0 10.543159 10.364053  2.564949 6.578965 1 0 1
      11 2006 0 11.502394 10.543159 2.6390574 6.964624 1 0 1
      11 2007 0 11.337053 11.502394   2.70805 7.333536 1 0 1
      11 2009 0  11.80083 11.337053  2.833213 8.027098 1 0 1
      11 2010 0 10.954906  11.80083  2.890372 8.354249 1 0 1
      12 2005 0 11.793714 10.954906  2.564949 6.578965 1 0 0
      13 2006 0 10.790165   10.3016 2.6390574 6.964624 1 0 0
      13 2008 0  11.40891 10.790165  2.772589 7.687248 1 0 0
      13 2005 1   10.3016 11.793714  2.564949 6.578965 1 0 0
      15 2003 0  10.37262  11.40891  2.397895 5.749902 1 0 0
      15 2004 0  11.33141  10.37262  2.484907 6.174761 1 0 0
      15 2006 0 10.695192  11.33141 2.6390574 6.964624 1 0 0
      15 2007 0 10.843062 10.695192   2.70805 7.333536 1 0 0
      15 2008 0  11.15133 10.843062  2.772589 7.687248 1 0 0
      15 2009 0 11.211205  11.15133  2.833213 8.027098 1 0 0
      15 2010 0 10.791556 11.211205  2.890372 8.354249 1 0 0
      15 2011 0   11.0646 10.791556  2.944439 8.669721 1 0 0
      15 2012 0 10.343367   11.0646  2.995732 8.974412 1 0 0
      16 2003 0 12.426764 10.343367  2.397895 5.749902 2 0 0
      16 2005 0 12.644836 12.426764  2.564949 6.578965 1 0 0
      16 2006 0  12.62607 12.644836 2.6390574 6.964624 1 0 0
      16 2007 0 12.554325  12.62607   2.70805 7.333536 1 0 0
      16 2010 0  11.74298 12.554325  2.890372 8.354249 1 0 0
      16 2011 0 12.575934  11.74298  2.944439 8.669721 1 0 0
      16 2012 0 12.611078 12.575934  2.995732 8.974412 1 0 0
      17 2003 1 10.766217 12.611078  2.397895 5.749902 1 0 0
      17 2004 1 10.642968 10.766217  2.484907 6.174761 1 0 0
      end
      label values export cat_export
      label def cat_export 0 "Non-exporting", modify
      label def cat_export 1 "Exporting", modify
      label values size cat_size
      label def cat_size 1 "Micro", modify
      label def cat_size 2 "Small", modify
      label values foreign foreign1
      label def foreign1 0 "Domestic firm", modify
      label values sector cat_sector
      label def cat_sector 0 "Service", modify
      label def cat_sector 1 "Manufacturing", modify
      thank you


      Comment


      • #4
        Thanks. After getting your data, I ran the commands

        Code:
        xtset firm year
        eststo: xtprobit export lntfp lagtfp age age2 i.size foreign sector,re
        I did this both in Stata 12 and Stata 15.1. The models would not converge but I did not get errors like you did.

        Are you sure both Stata 12 and eststo are up to date? In Stata 12 I get

        Code:
        . update query
        (contacting http://www.stata.com)
        
        Update status
            Last check for updates:  24 May 2019
            New update available:    none         (as of 24 May 2019)
            Current update level:    23 Jan 2014  (what's new)


        eststo is mostly just a convenience. You can use the estimates store command instead.
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        StataNow Version: 19.5 MP (2 processor)

        EMAIL: [email protected]
        WWW: https://www3.nd.edu/~rwilliam

        Comment


        • #5
          Thank you Richard..the estimation issue is solved now..I am just worried that estimating the same model in stata12 and stata15 did not converge. do you think using stata12 is a hold back for me?

          Comment


          • #6
            How did you solve it?

            i assume you only posted part of your data. If so convergence issues are not necessarily a concern.

            it is always nice to have the latest version of Stata. When a student comes to me with a problem who is running Stata 13, the first thing I like to do is run it in 15. I don’t want to spend hours on a problem Stata fixed years ago.

            Whether the upgrade is critical for you, I don’t know. Stata 12 was pretty good back in its day. But Stata 15 has many improvements and fixes.
            -------------------------------------------
            Richard Williams, Notre Dame Dept of Sociology
            StataNow Version: 19.5 MP (2 processor)

            EMAIL: [email protected]
            WWW: https://www3.nd.edu/~rwilliam

            Comment


            • #7
              I just run xtprobit export lntfp lagtpf age age2 i.size sector foreign, re and then i did estimate store model1.. then it was easy to esttab model1 using file.tex

              thanks again,, i will try the update query

              all the best

              Comment

              Working...
              X