Announcement

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

  • T-test by options - continuous variable

    Hi,

    I'm trying to find out if a "delta" between two variables across time can be explained by another variable. Initially, I wrote the following code which worked:
    ttest (difference), by (indvar)
    but the independent variable I want to use now is continuous, which is not allowed in this option set. Is there a way to add continuous variable as a qualifier in the ttest?

    Thank you,

  • #2
    no, but you can get the same effect by using -regress- (recall that when the "by" variable is binary; the t-test and regression with an indicator variable are exactly the same thing; compare
    Code:
    sysuse auto
    ttest gear, by(foreign)
    regress gear i.foreign

    Comment


    • #3
      Thank you!

      Comment


      • #4
        On a related note, I wanted to visualize means difference in a paired sample ttest, with whiskers and statistical significance noted. Is there a way to do this with bar graph? In the options I don't seem to find a way to indicate the statistical significance. Thanks!

        Comment

        Working...
        X