The **t-test** is a statistical test of whether two sample means (averages) or proportions are equal. It was invented by William Sealy Gosset, who wrote under the pseudonym “student” to avoid detection by his employer (the Guinness Brewing Company). Guinness prohibited publications by employees, because another employee had divulged trade secrets in writing.

There are also one-sample versions of a the t-test, to tell if a sample has a mean equal to some fixed value, but these are relatively little used.

**When to use a t-test**

A t-test can be used to compare two means or proportions. The t-test is appropriate when all you want to do is to compare means, and when its assumptions are met (see below). In addition, a t-test is only appropriate when the mean is an appropriate when the means (or proportions) are good measures. See my earlier article for guidance on when to use the mean.

**Matched and unmatched t-tests**

There are two forms of the t-test. In the unmatched t-test, or independent t-test, it is assumed that the two samples are independent. In non-technical language, two samples are independent when knowing something about one does not affect what we know abou the other. For example, the average heights of men and women, drawn randomly from a population, are independent, since knowing the height of a particular man tells us nothing about the height of any particular woman. In a matched t-test, the two sample are not independent; for example, the heights of husbands and wives are not independent, since taller men may be married to taller women. More obviously, the length of people’s right and left feet are dependent, because knowing the size of a right foot tells us a lot about the size of the left foot.

**Assumptions of the t-test**

As noted above, the independent samples t-test assumes the two samples are independent. In addition, both forms of the t-test assume that the variances of the two populations are equal. There are good ways to adjust for unequal variances, provided that the sample sizes of the two

samples are approximately equal. However, if the variances are very different and the sample sizes are different, then the t-test is not a good measure. In addition, as noted above, the t-test only makes sense when the mean makes sense.

**If not the t-test, then what?**

If the t-test is not appropriate, then one alternative is a nonparametric test, such as Wilcoxon’s test. Another alternative is a permutation test, or a bootstrap. In my opinion, all three alternatives ought to be used more often.

**The t-test in SAS**

Suppose one wishes to test if men are heavier than women in a given population. If you sample 5 men and 5 women at random, you might get something like this:

Men: 140 180 188 210 190

Women: 120 190 129 120 130

You could read that into SAS® using

data ttest;

input sex $ weight @@;

datalines;

M 140 F 120 M 180 F 190 M 188 F 129 M 210 F 120 M 190 F 130

;

run;

and then run a t-test by using

proc ttest data = ttest;

class sex;

var weight;

run;

**The t-test in R**

In R, one could read the same data in using

sex <- c(rep(‘M’, 5), rep(‘F’, 5))

weight <- c(140, 180, 188, 210, 190, 120, 190, 129, 120, 130)

and then run a t-test using

t.test(weight~sex)

The output looks like

Welch Two Sample t-test

data: weight by sex

t = -2.4982, df = 7.851, p-value = 0.03758

alternative hypothesis: true difference in means is not equal to 0

95 percent confidence interval:

-84.364290 -3.235710sample estimates:

mean in group F mean in group M

137.8 181.6

Which is terser than the SAS output, but says essentially the same thing. However, by default, R uses the Welch t-test, which does not assume the variances are equal. To get the test with the assumption, you would use

t.test(weight~sex, var.equal = T)

I specialize in helping graduate students and researchers in psychology, education, economics and the social sciences with all aspects of statistical analysis. Many new and relatively uncommon statistical techniques are available, and these may widen the field of hypotheses you can investigate. Graphical techniques are often misapplied, but, done correctly, they can summarize a great deal of information in a single figure. ** I can help with writing papers, writing grant applications, and doing analysis for grants and research.**

** Specialties:** Regression, logistic regression, cluster analysis, statistical graphics, quantile regression.

You can **click here to email** or reach me via phone at 917-488-7176. Or if you want you can follow me on Facebook, **Twitter**, or LinkedIn.

I have been studying Quality of life and Subjective Well-Being in Male and Females subjects (90 + 90 = 180 subjects) in three BMI-Groups of Obesity (30+30+30 for each gender: Total 6 Groups). I wish to compare scores on QOL and SWB, and also study interaction and correlation. I think ANNOVA is the best. Can I use regression or any scope for T-test? Which is the most appopriate of the three? Thanks.

Regression is the same model as ANOVA. If QOL is continuous or nearly so you can use either ANOVA or OLS regression. (The output will look different but mean the same thing).

I have done the Glanzer and Cunitz 1966 study, can i use a t-test if the data is not normally distributed?

I don’t know that study, but the t-test is robust to minor variations of normality, especially if sample sizes are equal

What statistical treatment can be used in testing the efficacy of the product in the investigatory project?

Hi Sofia – you’d need to tell me a lot more about the project before I could answer. In particular, how was efficacy measured? What was being investigated? Was it an experiment or an observational study? What was your sample? How many people were in it? And so on.

In the example above, can you express the difference of the means – 137.8 and 181.6 – as “43.8% difference in mean”? Does such a difference in % of the means hold any meaning?

Certainly you can say such a thing, and it means precisely what it says…. That is the difference between the means expressed as a %

Hi Peter, I’ve been getting confused about when to use the t-test/ alternative methods if the sample sizes are large. Some resources say you can use the t-test when n>30 as a rule of thumb (by the CLT) but I know that some population distributions need much higher n for the sampling distribution of the mean to be approximately normal. So my thoughts are that you should only use the t-test if the population is known as normal or if the sample data looks normal, for any n. What do you recommend? Thanks!

The t-test is fairly robust to non-normality if a) Sample sizes are large and b) Variances are relatively similar. However, using a nonparametric test will often lose only a small amount of power relative to the t-test

Hi, I am doing a research project on changing dynamics of talent acquisition in which I tend to compare both recruitment ways i.e: E-Recruitment and the traditional one. and on the basis of this comparison I will be analysing which one is the better recruitment process. can you please suggest me a test that I could run to get the appropriate result?

Hi Annie, I don’t have enough information. Are you measuring companies once or multiple times? How is recruitment measured? See How to Ask a Statistics Question

Message…

What would happen if you used a one-sample test in a situation where a two-sample test is ideal?

Well, the only way I can see that that could be done is if you falsely matched people. In that case, all your results would be wrong.

Good Afternoon Sir,

One of the objectives of my study is to compare between fraud and non-fraud companies and I have 20 variables. Sample size is 100 (50 fraud and 50 non-fraud). Can I use Independent sample T test? I have a doubt because my sample size is more than 30.

If yes, then how should I justify (since, its more than 30)

If no, Then what other test I can use ( in SPSS) to compare the samples?

You can use the t-test even if N > 30

I wanted to see if grammar instruction would improve student writing. I had my students write a paper (pretest), then introduced three grammar lessons and then had them write on the same prompt again. Almost every student improved his or her paper.

What type of t-test do I do to compare these scores?

thanks!

Larry Purdom

Hi Larry, since the same students took the test twice, it would be a matched t-test.

Peter

Thanks a bunch! One more? One-tail or two-tail?

LP

Thank you Mr. Flom. One more question, are we talking about a one-tail or a two-tail t-test?

Thanks.

Larry Purdom

Hi, I’m a medical student writing a theoretical research proposal and am baffled by the statistics – any help would be gratefully received! If I were doing a double blind randomized control trial looking into the differences in QoL measures and disease progression in a condition after intervention – would that require a t-test and ANOVA to assess whether there was any statistical difference between control and treatment group and then a regression analysis to test causal relationship? If you could explain what test I could use for a regression analysis that would be super? And would it be advisable to perform a pearson X2 test too? Many Thanks, Hannah

Hannah

If you have just 2 groups (intervention/control) then you could do a matched t-test. But it might be better to do a regression so you could account for other variables

Hi, I am doing on a study on wallaby vigilance and not sure what statistical analysis to use. There are 3 variables – Vigilance (measured by the average amount of times a group sticks their heads up), group size, and number of neighboring groups.

Hi Rebecca – from what you’ve said so far, it sounds like you need some form of count regression model. Poisson or negative binomial regression being good starting places.

Hi,

I am currently processing some data for my dissertation, I am comparing to methods of data collection. I have the same sample size for each method but I was wondering which t test to use, matched or unmatched?

They would be matched if there is something “the same” about certain pairs.

I really need to know which Test can i use to compare averages of say 4 categories before and after the Teacher Development Programme. Thanks

If it is the same people you can do a matched t-test on each category

Peter

Sir I m doing phd my topic is job satisfaction of female nurses comparative study of government nd private hospitals… sample size is 300 … wat tests can be applied on statistical analysis sir…please help

Hi Nisha – there is no way to know without a lot more information. Could be t-test, regression, multilevel model or something else. Peter

how can i contact u sir … can i mail u d synopsis

my sample size is 300 out of which 150 is of government hospitals and 150 of private … my questionnaire is based on linkert’s 5 point sacle.. u said tht t-test can be used .. what else test can be used for testing hypothesis …

Hi Peter, My study is to evaluate Pre and Post test for educational camp for girls and I have 15 variables. Sample size is 150. Can I use Paired T test considering my sample size. If no, then what other test can I use ( in SPSS) to compare the samples?

A t-test just compares two variables, it won’t be able to account for other variables. For that you would need some form of regression.

Hi Peter, i am doing a research on carbon quantification and wood basic density, what type of t-test should i use to compare wood basic density between stem and branch for sample size of 60 i.e 30 for each category? Thanks.

sir can u pls check my chapterization scheme for the topic….

Job Satisfaction Among Female Nurses

(A Comparative Study of Government and Private Hospitals)

Chapter 1

JOB SATISFACTION

1.1 Introduction

1.2 Definition of Job Satisfaction

1.3 Theories of Job Satisfaction

1.3.1 Situational Theories

Maslow’s Hierarchy of Needs

Herzberg’s Two Factor Theory

Social Information Processing Model (SIP)

Job Characteristics Model

1.3.2 Dispositional Approaches

1.3.3 Interactive/Process Theories

Adam’s Equity Theory

Cornell Model

Value-Percept Model

1.4 Summary and Integration of Job Satisfaction Theories

1.5 Factors affecting Job Satisfaction

1.6 Importance of Job Satisfaction

1.7 Impact of Job Satisfaction

1.8 History of Job Satisfaction Research

References

Chapter 2

NURSING AND OVERVIEW OF HOSPITALS

Section -A Nursing

2.1 Introduction

2.2 Definition of Nursing

2.3 Roles of Nurses

2.4 Nature of Nursing

2.5 Nursing Education in India

Section-B Healthcare System in India

2.6 Healthcare System in India

2.7 Healthcare Industry and Nursing Profession

Section-B Overview of Hospitals

2.8 Introduction

2.9 Classifications of Hospitals

2.10 Types of Hospitals

2.11 Organization Structure Chart of Government and Private Hospitals.

2.12 General Information about the Hospitals under Study.

References

Chapter 3

RESEARCH METHODOLOGY

Section A Conceptual Framework

3.1 Introduction of Research Methodology

3.2 Objectives of Study

3.3 Importance of Study

3.4 Scope of Study

3.5 Variables

3.6 Ethics of Research.

3.7 Limitations of Research

Section B Review of Literature

3.8 Introduction

3.9 Review of Related Literature

Section C Methodology

3.10 Introduction

3.11 Hypotheses

3.12Sampling

3.13Sources of Data

3.14 Instruments

3.15 Tools and Techniques

References

Chapter 4

DATA ANALYSIS

Section A Data

4.1 Introduction

4.2 Types and Sources of Data

4.3 Classification of Data

4.4 Tabulation of Data

4.5 Scaling and Rating

Section B Statistics

4.6 Introduction

4.7Branches of Statistics

4.7.1 Descriptive Statistics

Introduction

Tools Used

a) Percentage

b) Bar Graphs

c) Weighted Mean

4.7.2 Inferential Statistics

Introduction

Hypothesis Testing

Tools Used

a) Arithmetic Mean

b) Standard Deviation

c) T-Test

d) Chi Square Test

e) Analysis of Variance

Section C Analysis

4.8 Analysis of Data according to Descriptive Statistics

Demographic Factors

On the Job Factors

Rank Analysis

4.9 Analysis of Data According to Inferential Statistics.

T test

Chi-Square Test

Analysis of Variance

References

Chapter 5

CONCLUSIONS AND RECOMMENDATIONS

5.1 Introduction

5.2 Discussion and Conclusions

5.3 Summary of Findings Related to this Research

5.4 Recommendations

5.5 Scope for Future Research

References

Bibliography

Annexure

Looks OK to me, but you really want to check with your mentor or department.

Message…

Well, I’d have to know more about your study and spend a bunch of time figuring out exactly how it should work. For that, I’d have to charge you. But, again, this question is better asked of your committee

If I want to compare asian vs european femoral length. Do I have to compare the left and right femurs separately or can I just lump all the asian measurements together vs the european ones.The lengths of the left and right femurs are not independent of each other but the study samples (asian vs european) are. Should I just do a Mann-Whitney instead?

If you have one femur measurement from each person, the t-test should be fine. If you have two femur measurements from each person, I would still use just one. It makes the model a lot simpler and you aren’t going to lose much information (unless you are interested in right vs. left femurs).

The Mann Whitney test would not solve problems of dependent data.

Greetings,

I expect the answer at the end of my question to be either yes, no or maybe.

___

I know that when discussing a sample’s 95% confidence interval “they” indicate that this range describes the region that you would expect to find the true population mean to be located within, 95% of the time.

A sample’s 95% confidence interval, therefore has no bearing on where you would expect to find 95% of the population data.

___

I am trying to describe the plus 3 sigma and minus 3 sigma limits of a larger population using a limited sample size of 10 (degrees of freedom = 9).

First, from a z-chart plus and minus 3 sigma represents ~99.74%, so I am interested in having my upper and lower limits represent this population percentage. With a full population of information this would be,

mean ± 3 * σ.

I believe the t-chart provides the ability to describe statements about the population given a small sample size.

If we graph the Student’s t-test versus sample size, n, for 99.74% we get the following:

Where =tinv(1-.9974,n-1), using Excel

is plotted versus n.

(Clearly I could not paste the graph, but for small sample sizes: 5, 6 and 7, the tinv function is greater than four, but for large sample sizes, t is asymptotic to three.)

Here 5 is the first sample size point plotted with t(5) = 6.688.

A sample size of 10 produces t(10) = 4.119.

Therefore, with the caveat of saying, “If the sample mean is representative of the population mean and if the sample standard deviation is slightly smaller than a larger sample would indicate, then, I feel comfortable indicating that for a sample size of 10, we would expect that to find 6 sigma of the population to be bounded by,

sample mean ± 4.119 * sample standard deviation.

Is this close to the truth?

Jim, 7/28/2014

i don’t know what test to use to for my research questions and hypothesis.1.These are the question,What are the socioeconomic characteristics of cooperative thrift and credit societies members. 2. what are the determinants of members saving and credit in 2014 and the factors affecting credit accessibility.3. Has the activities of cooperative thrift and credit societies affected members businesses positively? Hypotheses,Ho: Membership of cooperative thrift and credit societies has positive effect on members business enhancement. Hi: Membership of cooperative thrift and credit societies does not have positive effect on members business enhancement. Please help me,my defense is on Monday 29th of this month…Thanks.

I am doing a presentation PowerPoint about T- test! Can you help me with finding stuff to mention. Important statements. I need to add “when is it appropriate to use a T test

Great information! Which would be best for the following. Sample size 42. Team leaders complete one questionnaire. Will measure them according to one of three leadership styles. All team leaders and team members complete another questionnaire to determine team effectiveness. All team leaders and team members are in the same team. I want to compare the results ofaq each leadership style to team effectiveness to see which best correlates. Thanks.

Sorry for the late reply. Something was wrong with my website. Do you still need help>?

Peter

Sorry I did not get to this, something was wrong with my website. Do you still need help?

Hi Sorry I did not get to this. Something was wrong with my website and I did not get notified. Do you still need help? Peter