Announcement

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

  • ppml_panel_sg

    Dear Statalisters,

    I have just found this command "ppml_panel_sg" to compute panel PPML structural gravity estimation. I have a panel dataset of 40 countries of origin and 17 destination regions. I want to estimate the determinants of FDI, so I have variables that characterize the regions.
    I run the following command in stata
    Code:
    ppm_panel_sg FDI_in lgdp_o lgdp_d, ex (Country_o) im(Region_d) y(Year)
    and get an error message that says that variable year is not found. However, my variable it is actually there, I can summarize it and stata shows the output. I ignore if I am typing the command wrong or what can be happening.

    I would be very grateful for any comment.

  • #2
    I have just found this command "ppml_panel_sg"
    You are asked to explain where you got it.

    Code:
    y(Year)

    Code:
    variable year is not found
    One of those must be wrong. According to your code you asked for Year; according to your error Stata was looking for year. Check again for consistency: Stata is case-sensitive in this and most other respects. If that's not the explanation the problem is not reproducible without a data example.

    Please do study FAQ Advice #12. http://www.statalist.org/forums/help#stata
    Last edited by Nick Cox; 07 Nov 2016, 12:27.

    Comment


    • #3
      Thanks for your quick answer.
      I am using Stata SE 12. The variable that identifies the time period in my panel is called Year. I tried typing

      Code:
      Y(Year)
      and stata replies
      Code:
      option Y() not allowed

      Anyway, I was looking also at the command reghdfe and I want to know if I wated to include country-time fixed effects as well as country-pair fixed effects in the regression, I would have to type
      Code:
      reghdfe lFDIin GDP_diff , absorb (Country_o Region_d Year)
      as it is explained in the help document of the ppml_panel_sg command or I would have to create the fixed effects and then include them as follows
      Code:
      reghdfe lFDIin GDP_diff , absorb (i.Region_d*i.Year i.Country_o*i.Year i.pairid)
      When I type
      Code:
      reghdfe lFDIin GDP_diff , absorb (Country_o Region_d Year)
      stata says that
      Code:
      string variables may not be used as factor variables
      Many thanks.

      Comment


      • #4
        One of your three variables is a string. You can "egen group" or "encode" to convert string variables to numeric ones, which is what reghdfe requires in absorb()

        Comment


        • #5
          Sorry, but I am lost on the original question. What you say in #1 bears no obvious relation to what you say in #3.

          If now you are only interested in reghdfe then

          1. As in #2 you are asked to explain where you found it.

          2. Sergio is running with this,

          Comment


          • #6
            Also, just to repeat on Nick's previous point: you probably have a typo in your command.

            Stata is case sensitive, so "y(year)" is very different from "Y(Year)". In fact, AFAIK options cannot have uppercase in their names, so I know for sure that Year() is not a valid option, but year() might be.

            Comment


            • #7
              Actually, I am interested in both commands. I want to run both estimations and compare the results, I did not posted the stata output because it had no sense for me but I post it now and maybe you have any suggestion.

              This is the output I get for ppml_panel_sg,
              Code:
                  ppml_panel_sg FDI_in Unemp_diff GDP_diff, ex(Country_o) im(Region_d) y(year)
              Initializing...
                         selectidx13():  3001  expected 1 arguments but received 2
                         country_ids():     -  function returned error
                               <istmt>:     -  function returned error
              r(3001);
              By the way, I renamed my Year variable and called it year and the command worked. Thanks for the advice.



              And this is the output for rghdfe,

              Code:
               reghdfe lFDIin Unemp_diff Labour_prod_diff Infraest_diff Wage_diff Human_capital_diff SIM RFE  if Year<=2013, absorb (i.Region_d2#i.Year i.Country_o2#i.Year i.pairid)
              (dropped 70 singleton observations)
              (converged in 13 iterations)
              
              HDFE Linear regression                            Number of obs   =        932
              Absorbing 3 HDFE groups                           F(   7,    540) =       0.72
                                                                Prob > F        =     0.6588
                                                                R-squared       =     0.9244
                                                                Adj R-squared   =     0.8696
                                                                Within R-sq.    =     0.0092
                                                                Root MSE        =     0.8322
              
              ------------------------------------------------------------------------------------
                          lFDIin |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
              -------------------+----------------------------------------------------------------
                      Unemp_diff |   1226.166    5701224     0.00   1.000    -1.12e+07    1.12e+07
                Labour_prod_diff |  -6484.582   4.37e+08    -0.00   1.000    -8.59e+08    8.59e+08
                   Infraest_diff |   13647.48   7.31e+08     0.00   1.000    -1.44e+09    1.44e+09
                       Wage_diff |  -444.4173   1.01e+09    -0.00   1.000    -1.98e+09    1.98e+09
              Human_capital_diff |   13163.19   1.01e+09     0.00   1.000    -1.99e+09    1.99e+09
                             SIM |   -402.375   323.8445    -1.24   0.215    -1038.524    233.7743
                             RFE |    1.90569   1.160056     1.64   0.101    -.3730853    4.184464
              -------------------+----------------------------------------------------------------
                        Absorbed |       F(384, 540) =     13.676   0.000             (Joint test)
              ------------------------------------------------------------------------------------
              
              Absorbed degrees of freedom:
              ---------------------------------------------------------------------+
                     Absorbed FE |  Num. Coefs.  =   Categories  -   Redundant     |
              -------------------+-------------------------------------------------|
                  Region_d2#Year |          165             165              0     |
                 Country_o2#Year |           84              94             10     |
                          pairid |          136             153             17 ?   |
              ---------------------------------------------------------------------+
              ? = number of redundant parameters may be higher
              Thanks.

              Comment


              • #8
                You are welcome!
                S

                Comment


                • #9
                  Dear Laura,

                  If you are having problems with ppml_panel_sg you may want to try either ppml or poi2hdfe, both of which are available form SSC. Also, I suggest you contact the author directly to see if he can help.

                  Best wishes,

                  Joao

                  Comment


                  • #10
                    Dear Statalisters,

                    Please apologize for merging into an already started conversation. As my query is also with regard to ppmlhdfe, I thought of posting it here expecting your help. I'm a PhD student working on the gravity equation for trade and income analysis.
                    I'm running a gravity equation for a panel with around 50,000 country pairs for 20 years. Also my equation includes lots of interaction variables (interact with year dummy) , that were used to convert time invariant variables in to time variant variables.
                    I found it impossible to impose pair fixed effects in ppml and hence I’m trying on work with ppmlhdfe.
                    I use the following ppmlhdfe command and predict fitppmlhd, mu to predict the trade values, which I will use to instrument actual trade values in the income regression.
                    ppmlhdfe trade_actual ldisyear1 ldisyear2 ldisyear3 ldisyear4 lsdisyear1 lsdisyear2 lsdisyear3
                    lsdisyear4 ///
                    ldpop_o ldpop_d ///
                    lareao_year1 lareao_year2 lareao_year3 lareao_year4 ///
                    laread_year1 laread_year2 laread_year3 laread_year4 ………bpop_o bpop_d, a(FE1=imp#year FE2= exp#year, save ) standardize_data(0)d vce(cluster idpair) nolog
                    predict fitppmlhd, mu
                    trade_predict= fitppmlhd

                    The problem currently I’m facing is when I use the predict fitppmlhd, mu, I can generate fitted values only for when actual trade>0. Actually I want to generate fitted values for all the potential pairs using gravity variables. For an example, if trade between AUS JPN for 2001 is “ .”, still I want to generate a fitted value for trade between AUS JPN for 2001. However, ppml command and predict fitppml, mu generates fitted values for all country pairs.

                    Your advice is greatly appreciated.

                    Thank you
                    Niluka

                    Comment

                    Working...
                    X