Announcement

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

  • Testing the significance of the difference between two means

    Hi Guys! I have computed the mean of growth rate of 34 countries before and after a particular period and I am interested in testing the difference between the two means. Someone please help me out with the command. For simplicity this is how I computed the means (sum gdpr if hipc == 0 ; sum gdpr if hipc == 1). With these two commands I have gotten two means and would like to test the significance of their difference.NB: in my data set HIPC is a dummy variable.

  • #2
    Code:
    ttest gdpr, by(hipc)
    2B or not 2B, that's a question!

    Comment


    • #3
      according to the help file for -ttest-, the code in #2 is for a two-sample test; however, you have paired info (if I understand #1 correctly); see
      Code:
      help ttest
      for the test in this situation

      Comment


      • #4
        Amo:
        if you investigate on the same countries before and after a given particular period (hipc), you are probably doing a sort of mirror study, where each country controls for itself.
        Hence, I would consider a paired -ttest- (See Example 4 under -ttest- entry, Stata .pdf manual), that requires data in -wide- format.
        However, I would prefer going -regress- (with -cluster- standard errors, as you have two observations per country):
        Code:
        regress gdpr i.hipc, cluster(country)
        PS: Crossed in the cyberspace with Rich's helpful reply that gives basically the same advice for -ttest-.
        Last edited by Carlo Lazzaro; 04 Sep 2018, 08:08.
        Kind regards,
        Carlo
        (Stata 16.0 SE)

        Comment


        • #5
          Hi Everyone,

          I am conducting Hausman test to decide between RE and FE. My understanding is that under the null RE&FE are consistent but RE is more efficient while an evidence against the null implies that FE is preferred. However, interestingly, the result of my Hausman test shows that b & B (coefficients for RE & FE) are exactly the same. In this case which of the two models is preferred? For more clarity these are my codes:

          qui xtreg kform hipc fdi01 mtrade inf01 gdpr d1emp popgr , fe
          estimates store p2fixed

          qui xtreg kform hipc fdi01 mtrade inf01 gdpr d1emp popgr , fe
          estimates store p2random

          hausman p2fixed p2random

          And below is the output of the Hausman Test
          Note: the rank of the differenced variance matrix (0) does not equal the number of coefficients
          being tested (7); be sure this is what you expect, or there may be problems computing the
          test. Examine the output of your estimators for anything unexpected and possibly consider
          scaling your variables so that the coefficients are on a similar scale.


          ---- Coefficients ----
          | (b) (B) (b-B) sqrt(diag(V_b-V_B))
          | p2fixed p2random Difference S.E.
          -------------+----------------------------------------------------------------
          hipc | 2.122118 2.122118 0 0
          fdi01 | 31.15151 31.15151 0 0
          mtrade | .2000892 .2000892 0 0
          inf01 | .0086346 .0086346 0 0
          gdpr | .0484184 .0484184 0 0
          d1emp | 12.05243 12.05243 0 0
          popgr | .9503585 .9503585 0 0
          ------------------------------------------------------------------------------
          b = consistent under Ho and Ha; obtained from xtreg
          B = inconsistent under Ha, efficient under Ho; obtained from xtreg

          Test: Ho: difference in coefficients not systematic

          chi2(0) = (b-B)'[(V_b-V_B)^(-1)](b-B)
          = 0.00
          Prob>chi2 = .
          (V_b-V_B is not positive definite)

          .
          Last edited by Amo Lewis; 07 Oct 2018, 14:26. Reason: To tag others

          Comment


          • #6
            Look more carefully at your code. You ran the -fe- model twice. That's why you got the same results both times.

            Added: This question has nothing to do with the original topic of the thread. It is important to keep threads on a single topic so that people who are searching the Forum looking for specific things can find them. In the future, when changing subjects, please start a new thread.

            Comment

            Working...
            X