Announcement

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

  • #16
    Ok, then a more Stata-based question. With which methods can someone compare two different intercepts of two different variables with a t-test. I'll just have to try all the feasible methods and pick the one which corresponds the most with the method described by my boss.

    Comment


    • #17
      What I get from your description is that you need to compare the parameters of the constants in both models. For these parameters you do have means as well as standard errors, so they can be compared. Doing this in Stata is a bit tedious but below I give an example below.
      Best,

      Aljar

      Code:
      clear all
      set obs 100
      gen x = rnormal()
      gen male = runiform() < 0.5
      gen y = 1 + 0 * male + x + rnormal() * 0.7
      
      reg y x if male == 1
      estimates store first
      
      reg y x if male == 0
      estimates store second
      
      suest first second
      test [first_mean]_cons = [second_mean]_cons

      Comment


      • #18
        I don't seem to have standard errors in my case, but I'm trying your code at the moment.

        Any opinion, advice, code is highly appreciated

        Aljar, why did you use 0.7 in your code and must I use gender instead of male?
        Last edited by Victoria Rogers; 24 Oct 2014, 07:37.

        Comment


        • #19
          I probably should have annotated the code, but I was under the impression that it would speak for itself. The first part is used to create some mock data such that the second part can be estimated. The 0.7 is used to add normally distributed noise with a standard deviation of 0.7 to the y. The 0.7 could have been changed to any number.
          See below for a version with annotations.
          Best,

          Aljar
          Code:
          // Create mock data
          clear all  // start with an empty data set
          set obs 100 // So we have hundred observations.
          gen x = rnormal() // Our independent variable.
          gen male = runiform() < 0.5 // Apparently you have observations on males and females. This will create a variable that has about 50 ones (males) and about 50 females
          gen y = 1 + 0 * male + x + rnormal() * 0.7 // The outcome y depends on x and noise. In this case the alphas should be the same when tested. Adjust the zero to the value of the difference.
          
          
          // Test your models
          reg y x if male == 1 // run your regression on males
          estimates store first // store the estimates
          
          reg y x if male == 0 // run regression on females
          estimates store second // store the estimates
          
          // Test if both constants are the same.
          suest first second
          test [first_mean]_cons = [second_mean]_cons

          Comment


          • #20
            Victoria:
            - you can also consider -contrast- to investigate the evidence of a statistical significant difference in male vs female intercepts, like in the following example.
            Code:
            use auto.dta, clear 
            reg price i.foreign 
            contrast r.foreign
            In your regression -gender- will take the place of -foreign-.

            Kind regards,
            Carlo
            Kind regards,
            Carlo
            (Stata 18.0 SE)

            Comment

            Working...
            X