Announcement

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

  • Conditional variance, conditional mean

    Dear Users,

    I am using an estimator (PQML) which assumes that conditional variance is proportional to conditional mean. My model include more than ten variables, where the depended variable and some of the independent variables are continuous, but most of the independent variables are dummies.

    Now i would like to check whether this assumption holds. Do you know, how can i do so in Stata?

    Regards

  • #2
    You need to tell us more in which environment you have implemented the estimator. People here mostly discuss estimators that are implemented in Stata. In order to get useful reply you probably need to explain more about your model and show us some output so that everyone can understand what you are trying to do. That is how you can increase the chance of getting a useful reply.
    Roman

    Comment


    • #3
      Dear Roman,

      I am using Poisson Quasi (Pseudo) Maximum Likelihood estimator. It is called PQML or PPML. My model is the gravity model.

      I found the dataex tool. Here is the sample from my data and its description.

      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input str39(importer exporter) double trade int year float(lngdp_imp lngdp_exp lnar_imp lnar_exp) byte(border colony language fta fta2)
      "Angola"             "Algeria"                  0 2002 10.951736  9.344149 14.683342  14.03601 0 0 0 0 0
      "Angola"             "Algeria"                  0 2003 11.127537  9.543684 14.683342  14.03601 0 0 0 0 0
      "Angola"             "Algeria"                  0 2004  11.35057  9.892185 14.683342  14.03601 0 0 0 0 0
      "Angola"             "Algeria"                  0 2005 11.530626  10.39851 14.683342  14.03601 0 0 0 0 0
      "Angola"             "Algeria"                  0 2006 11.650311 10.692697 14.683342  14.03601 0 0 0 0 0
      "Angola"             "Algeria"                  0 2007  11.81286 11.009554 14.683342  14.03601 0 0 0 0 0
      "Angola"             "Algeria"                  0 2008 12.049423  11.34069 14.683342  14.03601 0 0 0 0 0
      "Angola"             "Algeria"              2.945 2009 11.829275 11.231788 14.683342  14.03601 0 0 0 0 0
      "Argentina"          "Algeria"                  0 2002 10.951736 11.533123 14.683342 14.833234 0 0 0 0 0
      "Argentina"          "Algeria"                  0 2003 11.127537 11.772185 14.683342 14.833234 0 0 0 0 0
      "Argentina"          "Algeria"                  0 2004  11.35057  11.93904 14.683342 14.833234 0 0 0 0 0
      "Argentina"          "Algeria"       444.43174475 2005 11.530626 12.118298 14.683342 14.833234 0 0 0 0 0
      "Argentina"          "Algeria"                  0 2006 11.650311    12.274 14.683342 14.833234 0 0 0 0 0
      "Argentina"          "Algeria"                  0 2007  11.81286 12.706125 14.683342 14.833234 0 0 0 0 0
      "Argentina"          "Algeria"             19.414 2008 12.049423 12.914118 14.683342 14.833234 0 0 0 0 0
      "Argentina"          "Algeria"                  0 2009 11.829275 12.843988 14.683342 14.833234 0 0 0 0 0
      "Australia"          "Algeria"                  0 2002 10.951736  12.96054 14.683342 15.855021 0 0 0 0 0
      "Australia"          "Algeria"                  0 2003 11.127537 13.206058 14.683342 15.855021 0 0 0 0 0
      "Australia"          "Algeria"                  0 2004  11.35057  13.39335 14.683342 15.855021 0 0 0 0 0
      "Australia"          "Algeria"                  0 2005 11.530626   13.5046 14.683342 15.855021 0 0 0 0 0
      "Australia"          "Algeria"                  0 2006 11.650311 13.551776 14.683342 15.855021 0 0 0 0 0
      "Australia"          "Algeria"                  0 2007  11.81286 13.657032 14.683342 15.855021 0 0 0 0 0
      "Australia"          "Algeria"                  0 2008 12.049423 13.869081 14.683342 15.855021 0 0 0 0 0
      "Australia"          "Algeria"                  0 2009 11.829275 13.738935 14.683342 15.855021 0 0 0 0 0
      "Austria"            "Algeria"      36.9396587632 2002 10.951736 12.243785 14.683342  11.33688 0 0 0 0 0
      "Austria"            "Algeria"       83.851200426 2003 11.127537 12.453602 14.683342  11.33688 0 0 0 0 0
      "Austria"            "Algeria"       77.108124969 2004  11.35057 12.592395 14.683342  11.33688 0 0 0 0 0
      "Austria"            "Algeria"       10.170165924 2005 11.530626 12.631578 14.683342  11.33688 0 0 0 0 0
      "Austria"            "Algeria"       23.432658903 2006 11.650311 12.683683 14.683342  11.33688 0 0 0 0 0
      "Austria"            "Algeria"       2.3082452363 2007  11.81286  12.86478 14.683342  11.33688 0 0 0 0 0
      "Austria"            "Algeria"      10.0684833483 2008 12.049423  12.96597 14.683342  11.33688 0 0 0 0 0
      "Austria"            "Algeria"     105.6300801085 2009 11.829275 12.893188 14.683342  11.33688 0 0 0 0 0
      "Bahrain"            "Algeria"                  0 2002 10.951736  9.041728 14.683342  6.519147 0 0 1 1 0
      "Bahrain"            "Algeria"             12.332 2003 11.127537  9.179826 14.683342  6.519147 0 0 1 1 0
      "Bahrain"            "Algeria"                  0 2004  11.35057  9.306765 14.683342  6.519147 0 0 1 1 0
      "Bahrain"            "Algeria"       1.9163419752 2005 11.530626  9.466102 14.683342  6.519147 0 0 1 1 0
      "Bahrain"            "Algeria"              9.202 2006 11.650311  9.825799 14.683342  6.519147 0 0 1 1 0
      "Bahrain"            "Algeria"                  0 2007  11.81286  9.986449 14.683342  6.519147 0 0 1 1 0
      "Bahrain"            "Algeria"             47.736 2008 12.049423  10.15467 14.683342  6.519147 0 0 1 1 0
      "Bahrain"            "Algeria"       35.016272265 2009 11.829275  10.04056 14.683342  6.519147 0 0 1 1 0
      "Bangladesh"         "Algeria"                  0 2002 10.951736 10.768764 14.683342 11.877555 0 0 0 0 0
      "Bangladesh"         "Algeria"                  0 2003 11.127537 10.855612 14.683342 11.877555 0 0 0 0 0
      "Bangladesh"         "Algeria"                  0 2004  11.35057  10.94511 14.683342 11.877555 0 0 0 0 0
      "Bangladesh"         "Algeria"                  0 2005 11.530626  11.00266 14.683342 11.877555 0 0 0 0 0
      "Bangladesh"         "Algeria"                  0 2006 11.650311  11.03426 14.683342 11.877555 0 0 0 0 0
      "Bangladesh"         "Algeria"                  0 2007  11.81286  11.28492 14.683342 11.877555 0 0 0 0 0
      "Bangladesh"         "Algeria"                  0 2008 12.049423 11.425528 14.683342 11.877555 0 0 0 0 0
      "Bangladesh"         "Algeria"                  0 2009 11.829275   11.5374 14.683342 11.877555 0 0 0 0 0
      "Belgium-Luxembourg" "Algeria" 1753.0990287260001 2002 10.951736 12.436447 14.683342  10.40771 0 0 1 0 0
      "Belgium-Luxembourg" "Algeria"     1645.568597686 2003 11.127537 12.644045 14.683342  10.40771 0 0 1 0 0
      "Belgium-Luxembourg" "Algeria"     968.6653502586 2004  11.35057  12.78744 14.683342  10.40771 0 0 1 0 0
      "Belgium-Luxembourg" "Algeria"     856.6470557706 2005 11.530626 12.823483 14.683342  10.40771 0 0 1 0 0
      "Belgium-Luxembourg" "Algeria"    1002.0786274893 2006 11.650311  12.87902 14.683342  10.40771 0 0 1 0 0
      "Belgium-Luxembourg" "Algeria"    1031.7708415266 2007  11.81286  13.06539 14.683342  10.40771 0 0 1 0 0
      "Belgium-Luxembourg" "Algeria" 444.21296683229997 2008 12.049423 13.161758 14.683342  10.40771 0 0 1 0 0
      "Belgium-Luxembourg" "Algeria"     575.4988308993 2009 11.829275  13.09362 14.683342  10.40771 0 0 1 0 0
      "Brazil"             "Algeria"       7.1175588585 2002 10.951736 13.134103 14.683342 15.956978 0 0 0 0 0
      "Brazil"             "Algeria"                  0 2003 11.127537 13.222153 14.683342 15.956978 0 0 0 0 0
      "Brazil"             "Algeria"                  0 2004  11.35057 13.405676 14.683342 15.956978 0 0 0 0 0
      "Brazil"             "Algeria"       20.222717822 2005 11.530626 13.690486 14.683342 15.956978 0 0 0 0 0
      "Brazil"             "Algeria"                  0 2006 11.650311 13.881263 14.683342 15.956978 0 0 0 0 0
      "Brazil"             "Algeria"                  0 2007  11.81286 14.149098 14.683342 15.956978 0 0 0 0 0
      "Brazil"             "Algeria"                  0 2008 12.049423 14.342967 14.683342 15.956978 0 0 0 0 0
      "Brazil"             "Algeria"                  0 2009 11.829275 14.325073 14.683342 15.956978 0 0 0 0 0
      "Cameroon"           "Algeria"                  0 2002 10.951736 9.2946615 14.683342    13.072 0 1 1 0 0
      "Cameroon"           "Algeria"                  0 2003 11.127537  9.519427 14.683342    13.072 0 1 1 0 0
      "Cameroon"           "Algeria" 14.190000000000001 2004  11.35057  9.666204 14.683342    13.072 0 1 1 0 0
      "Cameroon"           "Algeria"       14.456887411 2005 11.530626  9.733565 14.683342    13.072 0 1 1 0 0
      "Cameroon"           "Algeria"  9.001000000000001 2006 11.650311  9.815908 14.683342    13.072 0 1 1 0 0
      "Cameroon"           "Algeria"      13.1309428608 2007  11.81286  9.924847 14.683342    13.072 0 1 1 0 0
      "Cameroon"           "Algeria"              4.478 2008 12.049423 10.057163 14.683342    13.072 0 1 1 0 0
      "Cameroon"           "Algeria"      12.1808648729 2009 11.829275 10.059685 14.683342    13.072 0 1 1 0 0
      "Canada"             "Algeria"     831.6190054149 2002 10.951736 13.492978 14.683342 16.115707 0 0 1 0 0
      "Canada"             "Algeria"    1247.3004905705 2003 11.127537 13.658484 14.683342 16.115707 0 0 1 0 0
      "Canada"             "Algeria"    1142.8970254569 2004  11.35057 13.791992 14.683342 16.115707 0 0 1 0 0
      "Canada"             "Algeria" 1580.7378258458996 2005 11.530626 13.923298 14.683342 16.115707 0 0 1 0 0
      "Canada"             "Algeria"    1440.0523383564 2006 11.650311 14.039824 14.683342 16.115707 0 0 1 0 0
      "Canada"             "Algeria"    2135.9646762008 2007  11.81286  14.19249 14.683342 16.115707 0 0 1 0 0
      "Canada"             "Algeria" 1610.5823305348995 2008 12.049423 14.248992 14.683342 16.115707 0 0 1 0 0
      "Canada"             "Algeria" 1104.0239003139002 2009 11.829275 14.130934 14.683342 16.115707 0 0 1 0 0
      "Sri Lanka"          "Algeria"                  0 2002 10.951736  9.713306 14.683342 11.091483 0 0 0 0 0
      "Sri Lanka"          "Algeria"                  0 2003 11.127537  9.811723 14.683342 11.091483 0 0 0 0 0
      "Sri Lanka"          "Algeria"                  0 2004  11.35057  9.906194 14.683342 11.091483 0 0 0 0 0
      "Sri Lanka"          "Algeria"                  0 2005 11.530626 10.066381 14.683342 11.091483 0 0 0 0 0
      "Sri Lanka"          "Algeria"                  0 2006 11.650311 10.202353 14.683342 11.091483 0 0 0 0 0
      "Sri Lanka"          "Algeria"                  0 2007  11.81286 10.384377 14.683342 11.091483 0 0 0 0 0
      "Sri Lanka"          "Algeria"                  0 2008 12.049423 10.614323 14.683342 11.091483 0 0 0 0 0
      "Sri Lanka"          "Algeria"                  0 2009 11.829275    10.647 14.683342 11.091483 0 0 0 0 0
      "Chad"               "Algeria"                  0 2002 10.951736  7.594821 14.683342 14.065495 0 1 1 0 0
      "Chad"               "Algeria"                  0 2003 11.127537  7.909353 14.683342 14.065495 0 1 1 0 0
      "Chad"               "Algeria"                  0 2004  11.35057  8.392756 14.683342 14.065495 0 1 1 0 0
      "Chad"               "Algeria"                  0 2005 11.530626  8.680239 14.683342 14.065495 0 1 1 0 0
      "Chad"               "Algeria"                  0 2006 11.650311  8.785913 14.683342 14.065495 0 1 1 0 0
      "Chad"               "Algeria"                  0 2007  11.81286  9.064009 14.683342 14.065495 0 1 1 0 0
      "Chad"               "Algeria"                  0 2008 12.049423  9.244928 14.683342 14.065495 0 1 1 0 0
      "Chad"               "Algeria"             27.115 2009 11.829275  9.132755 14.683342 14.065495 0 1 1 0 0
      "China"              "Algeria"                  0 2002 10.951736 14.189713 14.683342 16.074392 0 0 0 0 0
      "China"              "Algeria"                  0 2003 11.127537 14.310793 14.683342 16.074392 0 0 0 0 0
      "China"              "Algeria"       44.793317836 2004  11.35057 14.473916 14.683342 16.074392 0 0 0 0 0
      "China"              "Algeria"       35.997232123 2005 11.530626 14.623705 14.683342 16.074392 0 0 0 0 0
      end


      Code:
      
      . des importer exporter year lngdp_imp lngdp_exp lnar_imp lnar_exp border colony language fta fta2
      
                    storage   display    value
      variable name   type    format     label      variable label
      -------------------------------------------------------------------------------------------------------------------------------------------------
      importer        str39   %39s                  names of the importers
      exporter        str39   %39s                  names of the exporters
      trade           double  %10.0g                 value of imports
      year            int     %8.0g                 year
      lngdp_imp       float   %9.0g                 log of gdp of the importer
      lngdp_exp       float   %9.0g                 log of gdp of the exporter
      lnar_imp        float   %9.0g                 log of land area of importers
      lnar_exp        float   %9.0g                 log of land  area of exporter
      border          byte    %8.0g                 1 for common border
      colony          byte    %8.0g                 1 for common colonizer
      language       byte      %8.0g                 1 for common language
      fta               byte  %10.0g              1 if both are fta1 members
      fta2            byte    %10.0g                1 if both are fta2 members
      My depended variable is trade (always positive). Fta dummies =1 if both countries are member to the same Free Trade Agreement.

      I hope this clarifies

      Regards
      Last edited by Yusu Ima; 28 Jan 2017, 10:57.

      Comment


      • #4
        Dear Yusu,

        PPML does not assume that conditional variance is proportional to conditional mean. PPML is optimal in that case, but it is valid even if that assumption is not valid. There are ways to test that assumption (see for example this paper), but I would not worry about it.

        Best wishes,

        Joao

        Comment


        • #5
          Dear Joao,

          Thank you for pointing this out. I have apparently misguided by one paper about the assumption.

          I am familiar with your Log of Gravity paper and have read it several times. To my knowledge, in the paper you speak about Reset test and Monte Carlo simulation only. I have done the reset test and passed it, with p value above 0.40. But people still want to know how optimal is my model.

          I know that reported variance and mean in the summary statistics are marginal, but not conditional. Could you say, is there anyway we can obtain conditional mean as well? Or, is there any benchmark methodology that we can compare unknown conditional variance and mean with the marginal ones?

          Regards,
          Yusu

          Comment


          • #6
            Dear Yusu,

            To check whether the conditional variance is proportional to the conditional mean you can use the procedure described around equations (12) and (13) of the paper.

            Anyway, to people who are worried about that, you can remind them that whenever a robust or clustered covariance matrix is used we are accepting that the estimator is not optimal, so there is no particular reason to expect PPML to be optimal.

            Best wishes,

            Joao

            Comment


            • #7
              Thank you so much, Joao! Your comment made me laugh.
              I will go over your paper once again.

              Best Regards

              Comment


              • #8
                Dear Joao,

                Sorry, i need to ask you one more question on this topic.

                I do not know much about the GMM and some days ago i was asked why i do not use GMM instead of PQML in my estimations. I have seen very few articles which use GMM so i guess that there should be strong reason for this. Could please say why we cannot use it? I appreciate if you would provide detailed information and some examples as i do not know about the Gmm too much.

                Regards,
                Yusu

                Comment


                • #9
                  Dear Yusu,

                  Actually, in the Log of Gravity the estimator is is presented as a GMM estimator that turns out to be identical to PQML/PPML. So, you are actually using GMM :-)

                  Best wishes,

                  Joao

                  Comment


                  • #10
                    Dear Jaoa,

                    Let me ask one question before i am completely lost. Is the estimator presented in the log of gravity Generalized Methods of Moments (GMM) or Generalized Linear Model (GLM)?
                    Can we replicate the results from the PPML with any GMM command?

                    Regards,
                    Yusu

                    Comment


                    • #11
                      Dear Yusu,

                      It is both a GMM and GLM and indeed you can obtain the PPML results using a GMM command.

                      Best wishes,

                      Joao

                      Comment


                      • #12
                        Dear Joao,

                        Thank you for your response. This is something very new for me. As you know, the PPML usually used with the fixed effects in the gravity model. Could you say, would the results be identical to PPML results if we use fixed effects (for example importer and exporter fixed effects)?

                        Since you are expert in this area, I also would like to ask you one more thing, Do you know why the scholar do not usually use GMM instead of PQML? Perhaps there are some pros of PQML and cons of GMM?

                        Thank you for your response in advance.

                        Comment


                        • #13
                          Dear Yusu,

                          Indeed, you can use fixed effects with ppml, but there are other commands that may be computationally more convenient (although the results are the same); see, for example, -ppml_panel_sg-

                          PQML and PPML are identical and both are GMM estimators. So, as I said above, using PQML/PPML is actually using GMM. Actually, probably most estimators you know (ML, IV, OLS) are also GMM estimators.

                          Best wishes,

                          Joao

                          Comment


                          • #14
                            Dear Joao Santos Silva
                            Can you please explain how you would run in Stata, such conditional variance and mean checks as you refer to as equations 12 and 13 in your paper?
                            Regards,
                            Anthony

                            Comment


                            • #15
                              Dear Anthony ODowd,

                              You can ignore eq (13) and stick to (12); the best way to estimate (12) is to run a PPML regression of the squared residuals on the log of the fitted values.

                              Best wishes,

                              Joao

                              Comment

                              Working...
                              X