# One Sample t Test

The t distribution provides a good way to perform one sample tests on the mean when the population variance is not known provided the population is normal or the sample is sufficiently large so that the Central Limit Theorem applies (see Theorem 1 and Corollary 1 of Basic Concepts of t Distribution).

It turns out that the t distribution provides good results even when the population is not normal and even when the sample is small, provided the sample data is reasonably symmetrically distributed about the sample mean. This can be determined by graphing the data. The following are indications of symmetry:

• The boxplot is relatively symmetrical; i.e. the median is in the center of the box and the whiskers extend equally in each direction
• The histogram looks symmetrical
• The mean is approximately equal to the median
• The coefficient of skewness is relatively small

Example 1: A weight reduction program claims to be effective in treating obesity. To test this claim 12 people were put on the program and the number of pounds of weight gain/loss was recorded for each person after two years, as shown in columns A and B of Figure 1. Can we conclude that the program is effective?

Figure 1 – One sample t test

A negative value in column B indicates that the subject gained weight. We judge the program to be effective if there is some weight loss at the 95% significance level. Usually we conduct a two-tailed test since there is risk that the program might actual result in weight gain rather than loss, but for this example we will conduct a one-tailed test (perhaps because we have evidence, e.g. from an earlier study, that overall weight gain is unlikely). Thus our null hypothesis is:

H0: μ ≤ 0; i.e. the program is not effective

From the box plot in Figure 2 we see that the data is quite symmetric and so we use the t test even though the sample is small.

Figure 2 – Box plot for sample data

Column E of Figure 1 contains all the formulas required to carry out the t test. Since Excel only displays the values of these formulas, we show each of the formulas (in text format) in column G so that you can see how the calculations are performed.

Thus where range R1 is B4:B15, we see that n = COUNT(R1) = 12, = AVERAGE(R1) = 4.67, s = STDEV(R1) = 11.15 and std err = s$\sqrt{n}$ = 3.22. From this we see that

with df = 11 degrees of freedom.

Since p-value = TDIST(t, df, 1) = TDIST(1.45, 11, 1) = .088 > .05 = α, the null hypothesis is not rejected. This means there is an 8.8% probability of achieving a value for t this high assuming that the null hypothesis is true, and since 8.8% > 5% we can’t reject the null hypothesis.

The same conclusion is reached since

tcrit = TINV(2*α, df) = TINV(.1, 11) = 1.80 > 1.45 = tobs

Note that if we had used the normal distribution for the hypothesis testing as described in Sampling Distributions we would have gotten the following results:

NORMDIST(x, μ, σ, TRUE) = NORMDIST(4.67, 0, 11.15, TRUE) = .926 < .95 = 1 – α

which would again shows that the null hypothesis can’t be rejected. We see that the probability of being in the critical range is .074 compared to .088 in the t distribution case. In fact, the large sample test (via the normal distribution) is not as accurate as the small sample t distribution test.

Example 2: A school board wanted to see if reading test scores have changed in the past 30 years by testing a random sample of 40 students to see whether there is a significant change from the average score of 78 thirty years ago. The scores of the sample are as follows:

Figure 3 – Random sample data

Based on this data, can we claim that the reading scores have changed in the past 30 years?

From the Histogram data analysis tool we see that the data is reasonably symmetric. This is confirmed by the Descriptive Statistics data analysis tool since the mean and median are approximately equal and the skewness is close to zero (see Figure 4). This justifies the use of a  t test. This time we will perform a two-tailed test.

Figure 4 – Testing for symmetry

We set the null hypothesis to be:

H0: µ = 78

This time we use the One Sample option of the T Test and Non-parametric Equivalents supplemental data analysis tool provided by the Real Statistics Resource Pack (as described below). The output is shown in Figure 5.

Figure 5 – Real Statistics one sample t test

From the above we see that

with n – 1 = 39 degrees of freedom.

Thus, p-value = TDIST(t, df, 2) = TDIST(3.66, 39, 2) = .00074 < .05 = α, and so we reject the null hypothesis and conclude there is a significant change (i.e. reduction) in test scores.

Alternatively we can calculate, tcrit = TINV(α, df) = TINV(.05, 39) = 2.02. Since |tobs| = 3.66 > 2.02 =|tcrit|, once again we reject the null hypothesis.

Real Statistics Data Analysis Tool: The Real Statistics Resource Pack provides a supplemental data analysis tool called T Tests and Non-parametric Equivalents, which provides access to the t test for one sample, two independent samples and paired samples, as well as the non-parametric equivalent tests (Mann-Whitney and Wilcoxon Signed-Ranks tests).

For Example 2, enter Ctrl-m and select T Tests and Non-parametric Equivalents from the menu. A dialog box will appear as in Figure 5a.

Figure 5a – Dialog box for T Tests and Non-parametric Equivalents

Enter A5:D14 in the Input Range and 78 for the Hypothetical Mean/Median, unclick Column headings included with data, choose the One sample and T test options and press OK. The output appears in Figure 5. The confidence interval and effect size output in Figure 5 will be described next.

### Confidence interval

As described in Confidence Intervals for Sampling Distributions, we can define the confidence interval associated with the t distribution as

Example 3: Calculate the 95% confidence interval for Example 2

This yields a 95% confidence interval of (63.10, 73.70). Since the interval doesn’t contain the hypothetical mean of 78, once again we are justified in rejecting the null hypothesis.

Excel Functions: Excel 2010/2013 provide the following function to calculate the confidence interval for the t distribution.

CONFIDENCE.T(α, s, n) = k such that ( – k,  + k) is the confidence interval of the sample mean; i.e. CONFIDENCE.T(α, s, n) = tcrit ∙ std error, where n = sample size, s = sample standard deviation and 1 – α is the confidence %.

Thus for Example 2, we calculate CONFIDENCE.T(.05,16.57,40) = 5.30 which yields a 95% confidence interval of (68.40 – 5.30, 68.40 + 5.30) = (63.10, 73.70). The same result was obtained from the T Test and Non-parametric Equivalents data analysis tool, as shown in range D56:T56 of Figure 5 .

Observation: Excel’s Descriptive Statistics data analysis tool has an option for generating the confidence interval for a sample or collection of samples using the  t distribution. Referring to Figure 2 of Descriptive Statistics Tools, to choose this option click on the Confidence Interval for Mean checkbox and specify the confidence percentage (i.e. 1 – α) if you want to override the default of 95%. E.g. from Figure 4 we see that the 95% confidence interval value in the Descriptive Statistics output for the data in Example 2 is 5.299731.

Real Statistics Excel Functions: The Real Statistics Resource Pack provides the following supplemental functions:

STDERR(R1) = standard error of the data in the range R1 = STDEV(R1) / SQRT(COUNT(R1))

CONFIDENCE_T – equivalent to CONFIDENCE.T (for Excel 2007 and earlier versions)

T_CONF(R1, α) = k such that ( – k + k) is the 1 – α confidence interval of the sample mean for the data in range R1 based on the t distribution

T_LOWER(R1, α) = the lower end,  – k, of the 1 – α confidence interval of the sample mean for the data in range R1 based on the t distribution

T_UPPER(R1, α) = the upper end,  + k, of the 1 – α confidence interval of the sample mean for the data in range R1 based on the t distribution

If α is omitted it defaults to .05. These functions ignore any empty or non-numeric cells.

### Effect size

As explained in Standardized Effect Size, when the population variance is known we can use Cohen’s d as an estimate of effect size where:

When the population variance is unknown we can use the sample standard deviation as an estimate of the population standard deviation

In Dichotomous Variables and the t-test, we show another measure of effect size. We now show how to calculate the Cohen’s effect size for Example 2.

Example 4: Calculate the effect size for Example 2.

which indicates a medium effect. This is the same result that was obtained using the T Test and Non-parametric Equivalents data analysis tool (see cell V51 of Figure 5).

### Statistical Power

We now show how to calculate the power of a t test using the same approach as we did in Power of a Sample for the normal distribution. In Statistical Power of the t Tests we show another way of computing statistical power using the noncentral t distribution.

Example 5: A university research group wanted to verify the results of a previous study done at another research institution of plants in combating aphids by using a combination of chemicals called Formula Z-protect. The previous study reported that the mean concentration of aphids after an application of Formula Z-protect was 52. The new study examined 20 plants with the concentration of aphids shown on the left side of Figure 6. Determine whether the new study is consistent with the previous results. Also determine the power of the new study.

We begin by calculating the power for the one-tailed test where the null hypothesis is H0: μ ≥ 52; later we’ll look at the power of the two-tailed test.

The usual one-sample hypothesis testing is shown on the upper right side of Figure 6a. We now turn our attention to the power analysis, shown on the lower right side of the figure.

Figure 6a – Calculation of power for a one-tailed test

The null hypothesis is rejected provided the sample  value is greater than the critical value of t, where tcrit = TINV(α*2, df) = TINV(.05*2, 23) = 1.713872. We double the value of alpha since we are considering the one-tailed test.

Let xcrit be the aphid concentration corresponding to tcrit. Thus,

And so xcrit = 1.713872 ∙ 2.105606 + 52 = 55.60874. We now assume the real population mean is the sample mean, namely 53.16667. As we saw in Power of a Sample, the situation is illustrated in Figure 6, where the curve on the left represents the t distribution being tested with mean μ0 = 52 and the normal curve on the right represents the distribution with mean μ1 =53.16667.

Figure 6 – Statistical power

When xcrit = 55.60874, the t statistic for the t distribution with mean 53.16667 is

Thus we have

β = P(ttcrit | μ = μ1) = T_DIST(1.159795, 23, TRUE) = 0.870985

And so power = 1 – β = .129015.

Note that T_DIST(t, df, TRUE) is equivalent the following formula:

=IF(t >= 0, TDIST(t, df, 1), 1 – TDIST(-t, df, 1))

or T.DIST(t, df, TRUE) in Excel 2010.

The specific test that was conducted did not reject the null hypothesis, but we also see that such a test would only have found a very small effect of size .1136 (cell G9 of Figure 6a) 12.9% of the time, which is quite poor. Shortly we will consider some of the ways of increasing power to more acceptable levels.

For each value of μ1 ≥ 52 we can repeat the above calculations to obtain a value of power. From these we obtain the power plot shown in Figure 7.

Figure 7 – Power curve for Example 2

Observation: We are about to conduct a series of what-if analyses. We will use the format shown in Figure 8 for each of these analyses, where the figure repeats the power calculation for Example 2.

Figure 8 – What if analysis (based on given mean)

Example 6: For the data in Example 5, answer the following questions:

1. What is the power of the test for detecting a standardized effect of size .4?
2. What effect size (and mean) can be detected with power .80?
3. What sample size is required to detect an effect of size .2 with power .80?

a) As described above, we use the following measure of effect size:

Thus μ1 = 752 + (.4)(10.31532) = 56.12612743. As in Example 5, we can then calculate the power of the test to be 59.6% as described in Figure 9:

Figure 9 – Calculating the power of one-tailed t test

b) We use Excel’s Goal Seek capability to answer the second question. Using the worksheet in Figure 9, we now select Data > Data Tools | What-If Analysis. In the dialog box that appears enter the following values:

Figure 10 – Dialog box to determine effect size required to obtain power of .80

We are requesting that Excel find the value of cell B10 (the effect size) that produces a value of .8 for cell B13 (the power). Here the first entry must point to a cell which contains a formula. The second entry must be a value and the third entry must point to a cell which contains a value (possibly blank) and not a formula. After clicking on the OK button, a Goal Seek Status dialog box appears and the worksheet from Figure 9 changes to that in Figure 11.

Figure 11 – Output from Goal Seek to determine effect size

Note that the values of a number of cells have changed to reflect the value necessary to obtain power of .80. In particular, we see that the Effect size (cell B10) contains the value 0.52484634. You must click on the OK button to lock in these new values (or Cancel to return to the original worksheet).

c) We again use Excel’s Goal Seek capability to answer the third question. Using the worksheet in Figure 9 (making sure that the effect size in cell B10 is set to .2), we now enter the following values in the dialog box that appears (see Figure 12):

Figure 12 – Goal Seek dialog box to obtain sample size for power of .80

After clicking on OK, the worksheet changes to that in Figure 13.

Figure 13 – Output from Goal Seek to determine sample size

In particular, note that the sample size value in cell B6 changes to 155.6562392. Thus the required sample size is 156 (rounding up to the nearest integer).

Example 7: Repeat Example 5 using a two-tailed test, i.e. where the null hypothesis is H0: μ = 52.

We note that the picture shown in Figure 6 changes to that shown in Figure 14.

Figure 14 – Power for a two-tailed test

The blue curve represents the t distribution assuming that the null hypothesis is true (where μ0 = 52 for our example). The two critical regions (left and right) are determined by the left and right critical values tcrit. The red curve represents the t distribution assuming that the null hypothesis is false (i.e. the alternative hypothesis is true). For our example we assume that the real population mean is given by the sample mean, i.e. μ1 = 53.16667. The value of beta is therefore the region bounded by the red curve, the x-axis and the line y = t-crit and y = t+crit. Power is then 1−β.

The analysis for Example 7 is shown in Figure 15.

Figure 15 – Calculation of power for a two-tailed t test

The power for the two-tailed test (cell L15) is 7.9%, which as expected is lower than the power for the one-tailed test.

### 123 Responses to One Sample t Test

1. Varun says:

Hey Charles, great info here. I have made it a habit to visit your website whenever anything about t distribution keeps bugging me. I just had a small query. As I understood, we use t distribution only when the sample size is less than 30, but the first example here has 40 counts. Were we not supposed to use simple normal distribution?? As such the count is more than 30, I had understood that we can apply CLT (through normal distribution). I must be missing something (still a beginner in Stats 🙁 )

• Charles says:

Hi Varun,
You can use the normal distribution and the Central Limit Theorem when the population standard deviation (or variance) is known. Since it is rather rare that the population standard deviation is known, it is common to use the sample standard deviation as an estimate for the population standard deviation, but this introduces additional error. The t distribution uses the sample standard deviation, which you can calculate from the sample data elements, and so it is common to use the t distribution instead of the normal distribution even with samples of more than 30 elements. For large samples the t distribution is very similar to the standard normal distribution, and so the answers you get will be very similar. You can see this from Figure 1 of the webpage http://www.real-statistics.com/students-t-distribution/t-distribution-basic-concepts/.
Charles

2. Rowell says:

I am using one-sample t-test, however, I don’t have data on hypothetical mean from which to compare the sample mean. What can you suggest? Should I arbitrarily get such? Thanks!

• Charles says:

Rowell,
You first have to ask yourself why you are using the one-sample t-test in the first place, i.e. what are you trying to test? E.g. you can always choose the sample mean as your hypothetical mean, but then what is the point of the test? You will clearly find there is an exact match and the test will show a significant result. If you don’t know what the hypothetical mean should be perhaps you shouldn’t use the test at all, but simply record what the sample mean is. If instead you want to test whether the population mean is at least some value b, then you are all set: use b as the hypothetical mean and adjust alpha to account for the fact that you are using a one-tail test. I hope this helps.
Charles

3. Lawrence Hinchee says:

This information was not very helpful, I have the data analysis added to my work book, but I cannot do a one sample t-test

• Charles says:

Hi Lawrence.

Sorry that you did not find the information useful. Please let me know what I could do to make the information more useful.

If you have downloaded the Real Statistics software then you should be able to do a one sample t-test by pressing Ctl-m and choosing the T Test option. On the dialog box that appears choose the One-sample option and you should be in business.

Charles

4. Colin says:

Sir

In example 1: TINV(α, df) = TINV(.05, 11) = 2.20 > 1.45
I think .05 should be .05*2 because it is a one tail test

Colin

5. Stefano says:

Sir Charles,
is it correct to apply t-test to a mean of a Likert (1-7 score) responses?
I explain better, there is a set of responses with n=60 and for Q1 (i.e. n=1 Q1=2; n=2 Q1=1; n=3 Q1=7; n=i Q1=x; mean Q1=4.52), and I apply t-test to Q1 mean.
I’m interested to understand if Q1 result is reliable.
Thanks.

• Charles says:

Stefano,
The one sample t test is used to determine whether the population mean has a value m based on data in your sample. I can’t tell from your example if this is what you are trying to test. You used the word “reliable”. Perhaps you are trying to test for reliability, in which case you might want to use Cronbach’s alpha: see the following webpage for more details: http://www.real-statistics.com/reliability/cronbachs-alpha/.
Charles

6. Traore says:

Dear charles.
thank you for the materials, but i still don’t understand something about the P value calculation why can we use T-Distri to calculate the P value please explain me more easily

• Charles says:

Dear Traore,
You can use the t distribution to calculate the p-value via the function TDIST or T.DIST, as shown in Figure 1 of the referenced page.
Charles

7. Jay Solanki says:

Dear Charles,

I am using t test for one sample. My sample size is 142. While going through your info, I find it difficult to arrive at alternate formula for t_dist that you have given. Can you help me in the following i) Is it correct to use t test – one sample for my study having sample size of 142 ii) How do I use Power for interpretation (final result). Please advise. Thanks. Jay

• Charles says:

Jay,
I can’t find an alternative formula for t_dist on the referenced page. Perhaps I missed it. What are you referring to?
I believe that I have responded to the rest of your comment in my response of yesterday.
Charles

8. Jay Solanki says:

I have done some calculations based on your guidelines. Can you tell me how do say that whether my hypothesis for t value is accepted or rejected. Based on the power what should be my analysis. Thanks, Jay

Mean 3.330985915
Mode 4
Std Dev 1.372071122
Sample 142
size 0.241230874
tails 1
Hyp Mean 3
std error 0.115141651
df 141
t-stat 2.874597622
P value 0.002336352
alpha 0.05

Power

t-crit 1.655732288
x-crit 3.190643749
real mean 3.330985915
t -1.218865335
beta 0.887534708
Power 0.112465292

• Charles says:

Jay,

Using the figures that you have written (I haven’t tried to verify them), I conclude:

Since p-value = 0.00234 < .05 = alpha, you reject the null hypothesis Power of 11.2% is quite low (assuming that the calculation is correct). You shoud consider using a larger sample. Charles

9. ARBS says:

Dear Charles,
Just a final verification from someone with very little knowledge on stat.
One can use T-test to compare a sample mean to be significantly the same as that of the population mean when the population mean is unknown?How does one set the null hypothesis for this?
Thank you very much

• Charles says:

The one sample t test is used when the population standard deviation (not the mean) is unknown. The t test tests whether the population mean has some specified value (often called the hypothetical mean). Examples 1 and 2 on the referenced webpage show how to set the null hypothesis for this test.
Charles

10. Peeraya says:

Dear Charles,

Thank you very much for your information. I am currently using T-test to test my result.
Now I am not sure if I did it correct. I have a set of data as one sample set. In this sample set, i have 1000 variables either ‘0’ or ‘1’ from my testing behaviors. (1 means behavior happened, 0 means behavior does not exist.) For example, it, in this 1000 numbers, has 700 times that show 1. Thus, observed behaviors happened 70%. Then I used T-test to find significance of this 70%. Is it appropriated to use T-test for this purpose? What can my hypothesis be?

Thank you very much.

• Charles says:

It doesn’t seem likely that you would want to use a one-sample t test in this situation. With just 0’s and 1’s the data is not normally distributed (one of the assumptions for the t test). If you let me know what hypothesis would you like to test, we can decide which test to use.
Charles

• Peeraya says:

Hi Charles,
Thank you very much.
I have a set of alternatives in my data where each data has x-value and y-value. Then I would like to compare trade-off behavior between them. If a pairwise alternative has trade-off relationship then it will keep result as ‘1’ otherwise ‘0’. Thus, I would like to compare than if one pairwise shows 30% trade-off and another pairwise has 70%. Are they both significant in percentage? Like can we say that 30% is important as well as 70% possibility. Thus, 30% trade-off should be considered and be able to represent data also.

11. Daniel Ying says:

Hi,
I have a question about the confidence interval. I ran a test on a set of sample data which produced the following data:
Average = 0.74%
Degrees of freedom = 117
Standard Deviation = 0.0219
Standard Error = 0.00203
Assuming that the total average is zero (\mu) , I get the statistics:
t-Value = 3.651
p-Value = 0.00068 (using excel T.DIST with probability density function)

Now if I want to create a confidence interval for the average the following month, within 95% (the alpha in this case is 0.05 which would reject the hypothesis, since p-Value < alpha). But doesn't this mean that I can create a confidence interval of 0.99932 making my alpha 0.00068 (which would not be rejected)?

That is, choosing a larger confident interval will make the hypothesis to be not rejected? Or have I gotten it wrong?

• Charles says:

Hi Daniel,
Rejecting the null hypothesis with a p-value of .00068 does not mean that the confidence interval is .99932 (whatever that means). The confidence interval is (.74-.00203*d, .74+.00203*d) where d = TINV(.05,117).
Charles

12. donjeta says:

Using social network havw positive inpact on modeling altruistic behavior in adolescents

• Charles says:

Charles

13. Daniel says:

Hi Charles,
I am pretty good with finding the mean and standard deviations, but I am struggling to answer this question for class. Could you please help me.

The vast majority of the world uses a 95% confidence in building confidence intervals. Give your opinion on why 95% confidence is so commonplace. Justify your response.
Construct a hypothetical 95% confidence interval for a hypothetical case of your choosing. Use your own unique choice of mean, standard deviation, and sample size to calculate the confidence interval. Select one (1) option provided below and analyze what will happen to your confidence interval based on the option you selected:
The confidence changes to 90%.
The confidence changes to 99%.
The sample size is cut in half.
The sample size is doubled.
The sample size is tripled.

• Charles says:

Daniel,
I would prefer not to do your homework assignment for class. You should do this yourself.
I will give you a hint though. Try answering the questions using an actual example. You can use one of the examples on the referenced webpage.
Charles

14. Sonam says:

Charles can you please explain me why do we use one sample T-test. what exactly it is used for. Can i use it for likert scale. How to interpret the result of One sample T-test

• Charles says:

As explained on the referenced webpage, the one sample t test is used to determine whether the mean of a population is significantly different from some fixed value. Examples 1 and 2 on the referenced webpage give examples of when the test is used. The data should be continuous, but the test can be used with ordered discrete data (such as Likert scale) provided the other test assumptions are met.
Charles

15. MJ says:

Hi Mr. Charles,
I’m doing a thesis regarding the significant decrease of index value in stock market during August for the so-called ‘Ghost Month Effect’. In my methodology, I test the monthly data for 20 years(1994-2013) and recorded if there is decrease that occurred for a particular month and afterwards made a table summarizing the total no. of times(out of 20 years) that a particular month had.

However, before counting the no. of declines I first assured that the decline that happened is significant using one-sample t-test(one tailed).I used the t-test for the difference of the daily data for each month and below is a sample result.
May 1995: Mean of the sample=14.5952381, t-statistic=1.908295131, t-critical=1.724718243
June 1995:Mean of the sample=-0.281904762
, t-statistic=1-0.065582771, t-critical=1.724718243

Ho=0
Ha or < the t-critical regardless of the sign of the sample mean. Hope you can enlighten me.

Thanks,
MJ

• Charles says:

MJ,

Your random variable seems to be x = the difference of the daily stock market index (for a given month). I don’t know what H0=0 means. Does this mean that the mean value of x is 0? This would indicate that if you have one big decline in the month it could have as much weight as a lot of small increases in the month (as opposed to testing whether on average half the days are declines and half are increases). I don’t understand what any of this would mean towards proving (or disproving) your original hypothesis that there is a decline in the indices in August.

A simple approach could be to use the t-test (or Mann-Whitney if the assumptions don’t hold) to see whether there is a significant difference between the index on the first of the month and last day of the month for 20 years, comparing say July with August. I can think of other approaches that could be suitable as well.

Charles

16. Meera says:

Dear Sir,

I’m back seeking more help. I’m studying the errors made by non-native speakers of English in my state. Did a survey of sample size 384. The mean error = 12.43229, Standard deviation =5.397572. I wanna say that the sample mean can be applied to the population. Am thinking about a single sample t-test. But there has been no previous study, so i got no population mean 2 apply. What should be my null hypothesis? I hv read the ones in examples 1 & 2 but they are different from my situation. Plz do help.

Regards,
Meera.

• Charles says:

Meera,
As you have said, unless you are comparing to some other study or result, there is no t test to perform.
It sounds like mean error = 12.43229 and Standard deviation =5.397572 captures the situation.
Charles

• Meera says:

Thank u Sir. Guess I’ll just find out the confidence interval and leave it at that.

Meera

17. Meera says:

Dear Sir,

Should I opt for Welch’s t-test instead of Student’s since my N is way more than 30 (sample size=384)? Also, is it OK to calculate ANOVA with samples of unequal length?

Regards,
Meera.

• Charles says:

Meera,

If by Welch’s t test you mean the t test with unequal variances, then the fact that N is large is not the determining factor for using Welch’s t test. You should use Welch’s t test when the variances of the two samples are very different.

Yes, you can use ANOVA with samples of unequal size. The websitre shows you how to do this. When samples are of unequal size, the test is less robust to violations of the assumptions (esp. unequal variances).

Charles

18. Meera says:

Hi Sir,

How different should the variances be to abandon Student’s T-test and go for Welch’s? I got samples with different variance differences (some around 20, some 3). Also, if the variances do not differ by much, is it OK to do Student’s T-test despite the large sample size?

Meera.

• Charles says:

Meera,
I tend to always use the t test with unequal variances instead of the t test with equal variances since if the variance are pretty close then the two tests give almost the same results anyway. In my experience unless the variances are really different (say one is more than 4 times the other), the tests give almost the same p-values.
I don’t see any reason not to use the t test with a large sample size.
Charles

19. Meera says:

Thank u Sir 🙂

20. Angel-Leaf says:

Fantastic, really clear explanation, thank you very much.

21. Michael says:

Have a question and would like to know your opinion:

For my business, I am measuring on-time performance. I have a data of deliveries and want to set up the right transit time for planning. At the moment, I am caring only if truck is late. Would you advise me on distribution and test should I use?
about 150 trucks are in data set, mean – 24, st dev – 10, confidence level needed – 85%

Thank you a lot!

• Michael says:

I just performed normality test – and data is skewed to the right.
Any ideas on the further actions?

• Charles says:

Michael,
It depends on how skewed the data is, but you can simply use the Wilcoxon signed rank test instead of the t test.
Charles

• Charles says:

Michael,
What hypothesis do you want to test?
Charles

• Michael says:

Charles,

I need to set up the value that would capture of 85% of arrivals.
I digged into the data and it appeared that there are 2 picks which can be easily described: if warehouse didn’t manage to do it on time, it arrives to our store the next day. So there is a gap in between.
Really have no idea how to measure.

Thank you!

Michael

• Charles says:

Michael,
Unfortunately, this doesn’t tell me what hypothesis you are trying to test. I don’t understand the problem you are trying to solve well information to give you any advice.
Charles

• Michael says:

As I understand it will be H0 (Hyp. 0) – that hyp. mean is < than real mean with confidence level 85%. Though I am not very sure about it…

22. Marcus Clayson says:

I am quite new to statistical analysis and to the latest version of Excel, as I last did number crunching in the days of Windows 95. I have recently had to relearn all this stuff and was expected to use Minitab, which I dislike. There is so much rubbish on the internet, and many students have to spend hours ploughing through it to find anyhting of value. This site is incredible. The quality of the resources is superb, the style of writing, the layout, the exposition, all first rate. I don’t know how you do it. Keep up the good work.

• Charles says:

Thank you Marcus for your support. I do expect to keep adding to the website and improving the software.
Charles

23. Pallavi says:

Dear Charles,

I have data from 82 respondents on a survey that measures service quality. The survey has two sections: Expectations and Perceptions, scores for both sections are in the form of likert responses. I want to show that there is significant difference between expectations scores and perceptions scores. I have seen from previous literature that researchers have made use of parametric tests like the t-tests to prove this significance in their research. However I am unable to identify what kind of t-test exactly to use and how to use it for my research.
Could you please advise on what kind of t-test i can use to prove the significance of difference between the expectation and perception scores.
Thanks

• Pallavi says:

Also, each section has 22 statements, so 22 statements under expectations and 22 statements under perceptions measuring the same 22 variables in both sections

• Charles says:

If the same 82 respondents fill in both parts of the survey, then the appropriate t test is a paired samples t test.

Since you are using a Likert scale, there is some question as to whether the normality assumption of the t test will be met. If not, you should use the nonparametric version of the t test, namely Wilcoxon signed ranks.

You also mention that each section has 22 statements, in which case the choice of test depends on which scores you are comparing. If, for example, you add up the 22 Likert scores for each section (for each respondent), then you will get a score which can be considered to be continuous, in which case, it is likely that the t test assumptions will be met and so you can use the t test.

Charles

• Pallavi says:

Thank you for this Charles.
On another note, can I please ask you to clarify my problem with a reliability test that I carried out for this survey. The cronbach’s alpha values were in the range of 0.73 to 0.90 for the pilot tests on 10 responses, deeming the scale to be reliable. However, when I ran a reliability test post survey with 82 responses, the cronbach’s alpha’s ranged from 0.57 to 0.83. What inferences can I make about this for my research.

Thanks

24. Bhagyashree says:

hi… isnt t-test ,the one that is limited to a sample size of 30 ?! unlike the 40 samples in example 2 ?

• Charles says:

The t test is not limited to samples of size 30.
Charles

25. Nirosha says:

Hi, I am struggling to use my licket scale data with t- test, I want to test attitudes of AI officers using seven variables with 5 point licket scale. can I use one sample t test to test hypothesis of there is a significant effects of AI officers attitudes towards relationship with farmers.

how I test one hypothesis using seven variables. I got t value for each variables.
How I test my hypothesis

thanks

• Charles says:

what hypothesis are you trying to test?
Charles

26. Nirosha says:

Thanks, I will briefly explain my problem. I selected 30 Agricultural extension officers to measure their information link with other actors in the sectors such as farmers, research officers, etc.
and Used seven variables to measure their perception towards the information link with others. ex:
I have frequent link with Research officers , I have update meeting once a month with research officers … etc and licket scale range highly significant link (+2) ; to (-2) no any significant link.

finally, I tried to test overall one hypothesis using all theses variables
and H1: I have significant information link with other actors of the network.

can i made such hypothesis using multiple variables?
because, when i run one sample t test, I got t values for each variables and some are significant and some are not.
then, I do not know how to test above hypothesis using each individual value

is their any methods to take value of total variables and test my above hypothesis.
I am sorry , I am very poor in statistical analysis and looking forward hearing from you

• Charles says:

If you want to take more than one variable into account, you can use Hotelling’s T-square test. See the webpage
Hotelling’s T-square.
Charles

• Nirosha says:

Dear Charles,

thank you very much. I think i can use SPSS for the analysis and it is under reliability analysis.
if so, can I use it to hypothesis testing ?
I am apologizing for continues inquires

Nirosha

• Charles says:

Dear Nirosha,
Since I don’t use SPSS I can’t say how it is organized.
Charles

• Nirosha says:

Ok. thank you very much for your candid support.Now I can follow your methods even without SPSS.
thanks for you great help again.

Nirosha

27. Nirosha says:

Dear charles,

Again I back due to problem of reliability test of my data. Before doing Hotelling t test I did Cronbach alpha test for reliability and got negative value for it. then, still can I use Hotelling t test.
as you mentioned, only the normality test is sufficient for t test ? what can I do if I got negative Cronbach alpha value (value is greater than 0.70).

Nirosha

• Charles says:

You should be able to use Hotelling’s test no matter what value you got from Cronbach’s alpha, but if your questionnaire is unreliable, you might question the value of any results you get as a result of the questionnaire.

A negative value for Cronbach’s alpha can mean that your questionnaire is testing more than one thing. If this isn’t your intention then you may need to reword some of your questions or remove one or more questions. You can use Cronbach’s alpha with one question removed to determine whether this will be helpful.

Charles

28. Nirosha says:

thank you very much. the service you given through this forum is priceless for the student like me who learn statistics. great service

29. John says:

I am confused about something: 1) When the population variance (sigma-squared) is known, we can use Cohen’s d as an estimate of effect size where d = abs (sample mean – population mean)/ Isn’t sigma the symbol for population standard deviation?? Above is talking about population variance (?))

2) I think you need more symbols to explain these. Like this: “When the population variance (sigma-squared) is unknown, we can use the sample standard deviation (s) as an estimate of the population standard deviation (sigma)”

• Charles says:

John,
If the population variance is known then the population standard deviation is also known since this is the square root of the variance. Sigma is the symbol for the population standard deviation.
Charles

30. John says:

In the Calculation of Power section, you have cell I24 = .870985. Using your numbers and even putting your numbers directly into the TDist formula (=TDIST(1.159795,23,1)), I get the same answer every time: 0.129015. I can’t work it out so it gets what you got (.870985). How are you getting that??
(For those pics, did you use the GETFORMULA UDF to show the formulas? Because for at least I24, the formula you are showing isn’t the formula that is being used to calculate that cell.)

• Charles says:

John,

The formula used is T.DIST(1.159795,23,TRUE) not =TDIST(1.59795,23,1). T.DIST is the Excel 2010/2013/2016 version of the TDIST function. Actually, I used the Real Statistics function T_DIST, which is identical to T.DIST except that it is available even for versions of Excel prior to Excel 2010.

Note that =TDIST(1.59795,23,1 is equivalent to =1-T.DIST(1.159795,23,TRUE)

Generally I use the Real Statistics function FTEXT to show a formula as text. Sometimes, I use an Excel 2007 formula, but show the Excel 2010 or Real Statistics version of the same formula.

Charles

31. John says:

Last question for tonight: In Figure 4, what is the formula used to get that 5.299731 for the 95% confidence Level?

• Charles says:

John,
=CONFIDENCE.T(0.05,s,n) where s = the standard deviation = 16.57 and n = sample size = 40.
Charles

32. Dimitrs says:

Hi Charles,

I have posted this question on another section of your website, i am reposting here since it is affecting all your real statistics functions. When I call the dialog box thorugh Ctrl+m, and try to run for example a t-statistic on one of your real statistics examples, say weight loss, i get the following error:

—————————
Microsoft Excel
—————————
Alpha must be a number between 0 and .5

I have tried all values within that range, including the 0.05 default option to no success.

Best
Dimitris

• Charles says:

The usual reason for this error is that you are using comma instead of period as the decimal symbol. In this case, you need to enter 0,05 instead of 0.05. If this what is already written in the field just re/enter the value manually.

Charles

• Victoria says:

Dear Charles,

I have the same problem as Dimitris. I tried all values within that rage, I put as 0.05 as 0,05, but it still doesn’t work. Could you please help to fix this bug?

• Charles says:

Victoria,
Did you try re-entering 0.05 as 0.05 (i.e. manually writing the exact same value)?
What language does your Excel use?
I will try to finally fix this problem which has plagued me from the beginning, but for now please try the above approach and see whether it works.
Charles

• Gerhard van Huyssteen says:

Hi Charles,

I also have the same problem. I use the South African/Afrikaans locale in Excel.

However, your solution (to use a comma) worked in my case. It would be great, however, it the problem could be fixed permanently, so that I don’t have to enter values manually.

Gerhard

• Charles says:

Gerhard,
I plan to introduce what I hope to be a solution in the next release of the software.
Charles

33. Per Forsberg says:

Dear Charles,

I am writing my bachelor thesis in finance. I am testing whether an active trading strategy is better than a buy & hold strategy. Both strategies have the same stocks but the active strategy buys a stock when you have a buy signal from a technical indicator “the moving average” and vice versa, sell the stock when there is a sell signal. After a sell signal, you buy a treasury bill with a risk free rate until a new buy signal.

The buy and hold strategy just buys the stocks on the first day and keeps it until the last day. I want to test if the active strategy is better.

I have 212 stocks with daily closing prices during 20 years and have calculated the monthly returns. I am thinking about comparing the difference between the monthly returns by just calculating the difference for each month and then put all differences in a one sample t-test assuming the mean to be 0.

Am I doing this correct?

Best regards, Per Forsberg from Stockholm, Sweden

• Charles says:

Dear Per,
It sounds like you have two factors: the 212 stocks and the 240 monthly returns. Perhaps you are combining the returns on all 212 stocks each month. In this case you could use the t test on the differences of the 240 monthly returns. Stock prices from one month to another aren’t completely independent (i.e. there is autocorrelation), but since you are taking the differences perhaps this approach is valid.
Charles

Dear sir i have a data for 5 years relating to growth of deposits in bank i have to find weather growth is significant or not how it is possible
1. 702.79
2. 753.55
3. 758.56
4. 887.32
5. 1108.73

• Charles says:

Mustaq,
You need to better define what you mean by growth. Do you mean that the values increase or do you mean that they increase exponentially, etc. etc.? Once you have determined which model of growth you are using then you can use the appropriate statistical test. E.g. if you are looking at exponential growth then you can use an exponential regression model, as described on the webpage Exponential Regression.
Charles

35. Jonathan Bechtel says:

Hi Charles,

For example 1, you list the Tcrit value as 2.200 in the excel diagram, but since it’s a 1-tailed test shouldn’t it be 1.80 since you need to do 2*P? (You use the 1.80 value later on in your explanation).

• Charles says:

Jonathan,
You are 100% correct. For some reason, the examples workbook contains the correct calculations, but the website doesn’t. I have just corrected the webpage.
Thanks for catching this error. Your help is most appreciated.
Charles

36. Jonathan Bechtel says:

Hi Charles,

You use this method for the 1 sample test, but the method based on the non central t distribution for the 2 sample tests.

Is it possible to use either method on either type of test? If not, why?

Thanks,

Jonathan

• Charles says:

Jonathan,
You can use either method on both tests.
Charles

• Jonathan Bechtel says:

Thank you Charles.

I’m currently trying to determine the Beta and Statistical power for all the examples here in order to hone my intuition for these things.

I tried to calculate the Beta/Power for example 1 on this page with this data for a 2-tailed test:

C.I: 7.0872 (2.20098*3.22)
Xcrit: 7.0872 (0 + C.I.)
T: 0.7517 (7.0872-4.66/3.22)
Beta: 0.46799 – TDIST(0.7517, 11, 2)
Power: 0.532 (1-Beta)

However, if I use T1_Power or the RealStats tool the Power of this test is 0.26304.

As far as I can see I’m using the method listed on this page correctly so I’m not sure why my results are different if you can use either method interchangeable. (I’m assuming T1_Power uses the NCT method to determine the Power).

• Charles says:

Jonathan,

My calculations are different from yours. I have done this quickly and so perhaps I have made a mistake, but I get the following:

t-crit 1.795884819
x-crit 5.782829113
mean 4.666666667
t 0.346629505
beta 0.632295153
power 0.367704847

This not the same as the answer using the noncentral T distribution, although it is closer than the value you calculated. I can’t recall whether the assumptions are different and so the values may not be identical.

Charles

37. I need help fellows, How could I set a plot test when working with one treatment Example in testing adaptation for the new seed variety entered your Country?

• Charles says:

You need to provide more information before I can answer your question. Also, by plot test do you mean a test plot for normality?
Charles

38. Michael says:

Hi Charles
Thanks for your very useful info.

Here’s a question for you: Is it possible to carry out a t-test with n=1 sample size?

I have a known population (n=52, mean 0.25, std dev 0.20), and a sample of one (value 1.25). I’d like to test whether that single sample is statistically different from the population. Can this be done?

Many thanks

• Charles says:

Michael,
In general you can perform testing with very small samples, but you shouldn’t expect too much from the results. In the case of a t-test, it is impossible to do this test with a sample with one element since df = n-1 = 1-1 = 0.
Charles

• Michael says:

Thanks Charles.
Is there any other statistical test I could use to test a single sample against a population?
Cheers

• Charles says:

Another choice is the Wilcoxon Signed-Ranks Test.
Charles

• Spiros says:

How can we use the Wilcoxon Signed-Ranks Test in this case? I have tried in Graphpad Prism but it says it requires at least n=2 in each group.

• Charles says:

Spiros,
Sorry, but I don-t know what case you are referring to.
In any case, you can-t use the Wilcoxon Signed/Ranks Test if n = 1.
Charles

39. Jay says:

How do you do a one sample hypothesis test for the proportion using real statistics?

• Charles says:
40. Sichao says:

Hi,

Can I ask what is the difference between one sample t-test and one-sample chi-square test? Is this the case that t-test works on parametric variables and chi-square test works on nonparametric variables?

Thanks!

• Charles says:

Sichao,
The tests are quite different, as you can see by looking at the details of each test on the Real Statistics website.
I don’t know what you mean by parametric and nonparametric variable, but the t test is a parametric test, while chi-square is a non-parametric test. The non-parametric version of the t test is not the chi-square test, but the Mann-Whitney test.
Charles

• Sichao says:

Thank you so much, Charles!

41. Austin says:

Hello Charles,

I have a data set of returns and I want to know if the data is significant to tell whether the mean is less than 0. Would I use t.dist.rt or t.dist? In your example one above, I don’t understand why you are using t.dist.rt rather than t.dist.

Also, let’s say that I can reject the null that the data’s mean is less than 0. How would I then test whether or not the mean is greater than 0? Is it simply using the opposite test? IE, if I use a t.dist for less than 0, would I then just run it using t.dist.rt for mean greater than o?

Thank you!

• Charles says:

Austin,
I am not sure which of the examples on the referenced webpage you are referring to. In any case, T.DIST.RT is just 1 – T.DIST, and in some sense it really doesn’t matter which function you use. The more important issue is which tail you use, the left or the right.
Charles

42. anteneh says:

Hi, sir. I am a final year MBA student. My thesis topic is “the effect of marketing mix elements on market share” since the subject company is single, I couldn’t collect the dependent variable. So I used 17 questions of 4 independent variables with 17 sub variables. Would you please tell me how I can use a one sample t-test?

• Charles says:

It doesn’t seem that the one sample t test is suitable, but you would need to provide a more complete description before I can say for sure.
Charles

43. anteneh says:

Thank for your prompt reply. Here I will try to describe the challenge I encountered. As I mentioned last time the dependent variable of my topic is “market share” which I couldn’t collect data on, because the subject company is single. So I developed a questinnaire (with 5 point likert scale, Interval data type) having questions like: 1. Product Quality has a significant effect in improving market share of the subject company. 2. Increasing product variety has a significant effect on improving market share of the subject company. 3. Good product packaging has a significant effect on improving market share of the subject company. And the like…… By the way the independent variables are 4Ps(product, price, promotion, and place) of the marketing mix. I planned to use a one sample t-test, to compaire a hypothesised mean to the population mean. Would yuo please give me advise on whether and how I can do this?

• Charles says:

If I understand correctly, you are going to do a number of one-sample t tests. In each t test you will compare the mean score from the questionnaire against some fixed score. Is this your approach and what do you plan to use for the fixed scores?

Regarding how to conduct the one-sample t test, this is described on the referenced webpage, and on further examples elsewhere on the website.

Charles

44. anteneh says:

Thank you charles. The middle term of the 5 point likert scale (3) is what I planned to use as the fixed score.

45. Vibhav says:

Hello sir I m doing Final year MBA and Sir my final year project Topic is Long Run Performance of Right Issues and Its Effect on Share Performance, so Sir can u please suggest me which test and statistical tools i m suppose to conduct to fulfill my Objectives
with the data i have collected is 10 firms offering Right issues, i have the firm’s 60 months Volume traded and Adj close data and for my second objective i have data of firm’s share price 20 days before Right issue offer and 20 days after right issue offer

• Charles says:

Vibhav,
You reference two objectives. What are these objectives?
Charles

46. Hello,

I have one column containing a 1 or a 0 according to the respondent’s sex.
A second column has the data about the IQ of the respondent.
How do I run a t-test between the boys and the girls?
I don’t want to have to create new columns with boys only or girls only.
Thanks!
Mark

• Charles says:

Mark,
Suppose that the range with the 0s and 1s is A1:A100 and the range with the IQs is B1:B100, then you can conduct a two-tailed t-test (assuming heterogeneous variances) using the array formula: =TTEST(IF(A1:A100=0,B1:B100,””),IF(A1:A100=1,B1:B100,””),2,3).
Charles

47. Hello Every One,
I have a got a vale which is a mean of 5 observations. I have lost the data of number of observations (5).
Is there any formula in excel through which I could get the values of expected observations by specifying the standard deviations.
Regards

Rizwan Ali Ansari
email: rizwans.ansari@gmail.com

• Charles says:

Rizwan,
Having the mean and standard deviation is not enough to calculate the 5 observation values.
Charles

48. Fred says:

Hello again Charles,
For a 2-tailed test you seem to be doubling the alpha value, for instance if alpha=0.05 for a one tail test, you would use 0.10, so 0.05 in both tails. I have also seen people use alpha=0.025 in each tail (so 5% in total). Is there any best practice for that?
Many thanks!
Fred

• Fred says:

Sorry, I just realized it might be due to the way Excel’s T.INV() handles quantiles compared to TINV()

49. Fred says:

Sorry Charles, last question 🙂

In Figure 14 above, why are the two t-distribution not the same? For H0 and H1, we need a t(n-1) distribution centered on the origin, don’t we?
Fred

• Charles says:

Fred,
The blue curve represents the t distribution assuming that the null hypothesis is true. The red curve represents the t distribution assuming that the null hypothesis is false (i.e. the alternative hypothesis is true). They are not the same.
Charles

• Fred says:

Yes but in both cases we are a looking at a t-distribution with the same degrees of freedom, the T statistic value changes but the distribution is the same? Thanks!
Fred

50. Tang says:

Hello, need some help here. I conducted a reading programme for 18 weeks with a group of 20 students. After the programme, they were given a 15-item questionnaire to measure their perceptions regarding the programme. I used the 5-point Likert scale for all the 15 items in the questionnaire.

I’ve done the descriptive statistics part (simple percentages), but I’m wondering if there’s any way I can also incorporate inferential statistics to make my research more solid?

-TangL

• Charles says:

Tang,
There are lots of ways of incorporating inferential statistics, but what to do depends on what sort of hypotheses you want to test.
Charles

• Tang says:

Hi Charles,

On the whole the results from the questionnaire show that the students really enjoyed the reading programme with many indicating ‘Strongly Agree’ to the items (eg: ‘I enjoyed the reading programme’, ‘I felt positive when participating in the programme’, ‘I would like to continue participating in the programme’, etc).

While the percentages present a strong case, can I also somehow incorporate a t-test or something to demonstrate statistical significance using the questionnaire data? I basically hypothesise that going through the reading programme will result in enjoyment of reading.

Thanks!

• Charles says:

Tang,
Without knowing the questions it is difficult for me to answer your question, but here are two potential approaches.
1. If you some people who didn’t go through the reading programme also fill out the questionnaire then you can use a two sample t test to compare the results of one question (e.g. I enjoy reading) between the two groups.
2. Assuming that only people who went through the reading programme filled out the questionnaire, you can use a paired t test to compare the results of two of the questions. If the assumptions of the t test are violated then you can use the Wilcoxon Signed Ranks test instead.
Charles