Announcement

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

  • Two sample unpaired ttest with mean difference specified

    I need to run a t-test on a two sample group that is unpaired with unequal variance for a specific mean difference.

    The data sample is unpaired and my research hypothesis is:
    Upstream- Downstream “at least” (one sided) ≥ 0.5ppm
    I found a note that STATA cannot do this:
    Unlike the SAS TTEST procedure, the .ttest command cannot specify the mean difference D0 other than zero.
    http://citeseerx.ist.psu.edu/viewdoc...=rep1&type=pdf

    If the data were paired I could create a new variable with the difference and run a ttest on that for the specified ppm.



    The "R" code is:
    t.test(Upstream,Downstream,alternative="greater",m u=0.5,conf.level=0.99)

    Thanks,

    Just a Noobie, Matt

  • #2
    So you can emulate this with a regression and the -lincom- commands.

    Let's say that the variable that distinguishes "upstream" from "downstream" is called location, coded 1 for upstream and 0 for downstream, and your outcome is called outcome.

    Code:
    regress outcome i.location
    lincom _b[1.location]-_b[0.location] - 0.5

    Comment


    • #3
      Welcome to Statalist.

      I think you could also just add or subtract a constant from one of the groups, e.g. subtract .5 from the group that you think is greater by .5.

      Also with Clyde’s, I think 0.location = 0. So, a simpler statement might be

      test 1.location = .5 (or else -.5)
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      StataNow Version: 19.5 MP (2 processor)

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

      Comment

      Working...
      X