Announcement

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

  • Independent t-test for differences other than 0

    Dear Stata Experts,

    I would like to run the independent t-test for the following dataset and want to test the null hypothesis for a difference of 300 instead of the default 0.
    The command I use so far is ttest "Outcome, by(Type) unequal"

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int Type double Outcome
    101 2997.5198380566803
    101 2937.7315789473687
    101 2955.9720647773283
    101  2956.985425101215
    101 2974.2125506072875
    101 2961.0388663967615
    101 2971.1724696356277
    101  2976.239271255061
    101 2966.1056680161946
    101  2948.878542510122
    101  2930.638056680162
     70  2598.276923076923
     70             2566.8
     70  2603.046153846154
     70  2646.923076923077
     70 2438.9846153846156
     70 2588.7384615384617
     70 2579.2000000000003
     70 2624.9846153846156
     70  2595.415384615385
     70 2586.8307692307694
     70 2625.9384615384615
    end
    Is there a way of doing that?

    Thank you in advance.
    Best,
    Amanda

  • #2
    Where does the 300 come from? If it's suggested by the data, then it seems to me that the real issue is a confidence interval for the mean difference.

    Comment


    • #3
      The command I use so far is
      ttest Outcome, by(Type) unequal

      Comment


      • #4
        Dear Nick,
        We have a specification limit for the maximum allowed difference between the means and that is, for this case, 300. I just want to test the following hypothesis:

        H0: The difference (P=0.95) between results obtained at pressure 1 and pressure 2 is significantly less than 300.
        H1: The difference between measuring at pressure 1 and pressure 2 is significant.

        Hope that helps!

        Comment


        • #5
          Pressure=Type in the code above.

          Comment


          • #6
            As a wording matter, I don't think the word "significant" should be in the phrasing of your hypotheses. It should be more like

            H0: The difference between results obtained at pressure 1 and pressure 2 is <= 300.
            H1: The difference between results obtained at pressure 1 and pressure 2 is > 300

            As for testing -- as Nick says, just look at the confidence interval, which in this cases ranges from -412.2304 to -337.107. -300 is not in the CI so reject the null.

            If this is meant to be a one-tailed test, which is what it sounds like to me given the way you phrase things, you can also do something like

            Code:
            clonevar XOutcome = Outcome
            replace XOutcome = XOutcome + 300 if Type == 70
            ttest XOutcome, by(Type) unequal

            -------------------------------------------
            Richard Williams, Notre Dame Dept of Sociology
            Stata Version: 17.0 MP (2 processor)

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

            Comment


            • #7
              Thank you Nick and Richard!
              I was curious about the possibility of having the number 300 in the command. But as you say, I'll continue interpreting the results by using the CI. I will try your suggestion as well Richard, just for learning more about Stata
              Best,
              Amanda

              Comment

              Working...
              X