# independent sample t test

#### w wang

##### New Member
independent-samples t-test is used when you want to compare the mean score (continuous dependent variable) on a binary independent variable. What happen if my DV is a binary variable and my IV is a continuous variable? What analysis should I use?

#### Karabiner

##### TS Contributor
Independent samples t-test. It tells you whether the 2 groups differ with respect to the interval scaled variable.
The test doesn't know that we human beings like to label one of the variables as dependent and the other one as independent.

With kiund regards

Karabiner

#### w wang

##### New Member
Hi Karabiner,
Thanks for your reply. do you mean I can still run the independent t sample and it still tell if there any mean difference between 2 group? But I cannot put the number in "define group"

#### Karabiner

##### TS Contributor
What you exactely mean with "put the number in the define group". I don't know, there are
dozens of statistical software packages and statistical online calculators out there.

You want to know whether the binary variable and the interval scaled variable are associated?
So you use the binary variable as the grouping variable in your t-test and the interval scaled
variable as the dependent variable (technically speaking).

With kind regards

Karabiner

#### w wang

##### New Member
Hi Karabiner,
I am trying to run the independent t test with SPSS. Normally you put binary variable as IV where you need to define the group. You put the continuous variable into the test variable. But now my IV is a continuous variable and my DV is a binary variable, can I still run the independent t test?

Yes.

Last edited:

#### Dason

I think karabiner is misreading. It sounds like you want something like logistic regression instead.

#### Karabiner

##### TS Contributor
I think karabiner is misreading. It sounds like you want something like logistic regression instead.
In most instances a simple t-test is sufficient. But, yes, also a logistic regression could be an option.

#### Dason

How exactly do you propose to use a t-test when the *independent* variable is continuous?

#### Karabiner

##### TS Contributor
I use the variable named "independent" as test variable and I use the variable labeled as "dependent" as group variable.
If I wanted to know if higher age predicts major depression yes/no, then I'd have a look at whether depressed subjects have
a higher mean age than undepressed subjects. To use a logistic regression in order to determine the odds ratio for each
additional year of age could be informative, but it is often not necessary, I suppose.

With kind regards

Karabiner

#### Dason

Independent variable means the variable that is the "predictor" (the x in a linear regression). The dependent variable is the variable that is being predicted (the y in the linear regression).

#### hlsmith

##### Less is more. Stay pure. Stay poor.
Loving it.

OP, it would also help if you described what your variables and context was. Yes, if I wanted to test whether sex predicts weight - boom t-test may be an option. If you wanted to test whether the probability of death is predicted by weight - boom a logistic regression may be an option.

However, with many binary dependent variables - time to event between groups may also be of interest, and survival analysis may be applicable. Also, if your binary IV is a treatment or intervention that was not randomized, you may need to control for difference between these groups. So describing your context becomes important from our perspective! But you seem to now be on the right path!

#### Karabiner

##### TS Contributor
Independent variable means the variable that is the "predictor" (the x in a linear regression). The dependent variable is the variable that is being predicted (the y in the linear regression).
Yes. If depressed persons are older than non-depressed persons, then age predicts depression.
It is a matter of labeling and of interpretation. If one needs a coefficient, maybe logistic regression
is the better choice (or perhaps a biserial correlation).

With kind regards

#### fed2

##### Active Member
with boxplots, you can rotate paper/head 90 degrees to change independant/dependant.

#### hlsmith

##### Less is more. Stay pure. Stay poor.
@fed2 - I am thinking about the terminology; with rotate I think in 2D, so like a clock. But is that the same term you would use if taking bottom (SE) corner and 'flipping' it to the top corner (NW)? Somebody hold my hand and remind me how this would go down in matrix algebra? Inverse something?

#### fed2

##### Active Member
box plots ain't no linear algebra thing. You just look at them and they are what they are.

Actually I had noticed something about the relationship between logistic regression and 2 sample exact tests. Namely the p-value for the exact logistic regression ends up being same as p-value for the exact 2-sample test with scores=data. At least i have not observed any difference although i never quite got to looking at it in any depth.

ie these are THsame
Code:
PROC GENMOD DATA = A;
MODEL X = Y...
EXACT Y

AND

PROC NPAR1WAY DATA = A;
VAR Y
CLASS X
EXACT SCORES
RUN
That's appropos here because it shows that the above debate can be circumvented in this case. Also it is useful as a practical matter because people always want to have the above debate for one reason or another.

#### fed2

##### Active Member
the lines look suspiciously parallel...good thinking though always good to see some box plots.