# When do I use chi square and when a t-test? I just don't get the difference...

#### mathsucks

##### New Member
Hi there,

I'm trying to teach myself statistics from a book but I don't understand when I have to use t test and when chi squares. I tried to look it up on google but I still don't get it!

To what I understood, you use BOTH for determining if there's a difference between groups and if this difference just occured by chance or not. I hope this is right.
But what is the difference/when to I use each?

Thank you!!

Last edited:

#### jjsz63

##### New Member
I want to also understand if the test to compare means are meant to be carried out only for experimental data.
I applied a non-paired t test, but I just want to make sure it applies.
I have taken data of salary budgets of all MLB teams from 2000 to 2014 and I have divided them in two groups
the first one, those that qualified to playoffs either as a division leader or as a wild card, and the other one, those that did not.
I proceeded to then compare the means.
Is this correct?

#### hlsmith

##### Less is more. Stay pure. Stay poor.
Seems like you are figuring things out. T-test usually when you have groups and you are comparing continuous values, with some assumptions needing to be met. Chi square is used with two groups or more comparing another categorical variable. Also cells or groups in table should have five or more observations.

Yes you can use tests on real world data. You just have to watch how you interpret results (association not causation most times) since you did not randomize treatments etc.

Your application seem fine, though you need to examine equality of variance between groups first.

#### jjsz63

##### New Member
What I actually did first was to graph all approximate 500 observations, salary budgets versus victories and i was waiting for a better coefficient of determination, but just got and an 11% explanation, which then when you see the graph one understands that obviously money just doesn´t translate directly to victories. So instead of looking for victories, I decided to look for those teams that qualified to a playoff spot versus those that did not and to then evaluate if the mean of their salaries were equal/different. And here the student t shows difference. I appreciate your comments, now I´m looking to see what you mention, the equality of the variances...so I´m doing the F test. 126 observations of those that won and 324 of those that did not. f is equal to 1.54 because mean1 100.26mm stddev1 43.2mm and mean2 77.6mm and stddev2 34.75mm. so variances are equal and according to unpaired t the means are different

#### jjsz63

##### New Member
Even further and more of a wider discussion.
the kind of testing I have been reading is for samples of a population, inferencing if one wants to refer to it.
What I am actually getting is data from the real world and interpreting but it is data that to me is that of the whole population, not sampling.
I am basically comparing the means of two groups that i have artificially created (those that made it and didn't make it to the playoffs) and want to analyze if their salaries are similar or not.
Is it correct to use the student t test?
my argument is that any mean to be calculated has inherently variance so you just cannot decide that one mean is larger than the other one just by comparing them numerically (which one is greater)....do you follow me? or Am I not making sense?

#### Miner

##### TS Contributor
Hi there,

I'm trying to teach myself statistics from a book but I don't understand when I have to use t test and when chi squares. I tried to look it up on google but I still don't get it!

To what I understood, you use BOTH for determining if there's a difference between groups and if this difference just occured by chance or not. I hope this is right.
But what is the difference/when to I use each?