# t-test formula

You are currently browsing articles tagged t-test formula.

# Hypothesis testing formula sheet

Test of mean of a normal distribution
a) case population variance known

$\frac{\bar{x} - \mu_0}{\sigma/\sqrt{n}}$
Critical value(s) from Z table

b) case population variance is unknown
$T = \frac{\bar{x} - \mu_0}{s/\sqrt{n}}$

Critical value(s) from t table with df = n-1

Test for the difference between 2 means
a) case of matched pairs

$T = \frac{\bar{d} - d_0}{s_d/\sqrt{n}}$
$d_i = x_i - y_i$ and d0 is the hypothesized difference.
Critical value(s) from t table with df = n-1.

Independent samples with population variances known or large samples

$T = \frac{\bar{x} - \bar{y} - d_0}{\sqrt{\sigma_x^2/n_x + \sigma_y^2/n_y}}$

For large nx, ny and unknown population variances, use sample variances.

c) Independent samples, small samples with population variances equal but unknown

$T = \frac{\bar{x} - \bar{y} - d_0}{s_p \sqrt{1/n_x + 1/n_y}}$

where $s_p^2 = \frac{ (n_x -1)s_x^2 + (n_y -1)s_y^2 }{n_x + n_y -2}$

Test of the population proportion in large samples
$T = \frac{\hat{p} - p_0}{\sqrt{p_0(1-p_0)/n}}$

where p0 is the value of the hypothesized value of the proportion. Use Z table.

Testing the difference between 2 proportions in large samples

$T = \frac{\hat{p}_x - \hat{p}_y}{\sqrt{p_0(1-p_0)/n_x + p_0(1-p_0)/n_y}}$

Use Z table.

Goodness-of-fit test formula sheet
Consider a random sample such that:

• there are n observations
• observation i (let’s denote it Oi), i=1,..n, falls into only one of k categories

The null hypothesis specifies the probabilities for an observation falling into each into each category.The test statistic that the data do follow the given probabilities is:
$T=\sum_{i=1}^{K}\frac{(O_{i}-E_{i})^{2}}{E_{i}}$

where the expected count for cell i if we there null were true, $E_{i}$ is $E_{i} = np_{i}$

Under the null, the test follows a chi-square distribution with df = number of categories (K) – number of any parameters estimated to calculate the probabilities (m) -1

Reject the null if the test statistic exceeds the critical value for a given significance level. The goodness-of-fit test is a one-tailed test.

Crosstabs formula sheet
Crosstabs is short for cross tabulation (and is also known as “contingency table”)
Consider a random sample of size n that are cross classified according to 2 attributes in a table with r rows and c columns.
The null hypothesis is: there is no relationship between the 2 attributes in the population. The test statistic is:

$T=\sum\frac{(O_{ij}-E_{ij})^{2}}{E_{ij}}$

where the summation is over all cells; Oij is the actual observed count in cell row i, column j. The estimated expected count for cell in row i and columnn j if the null were true, Eij is

$E_{ij} = \frac{R_iC_j}{n}$

where Ri is the row i sum of counts; Cj is column j sum of counts.
Under the null, the test follows a chi-square distribution with df = (r-1)*(c-1).
This test is a one-tailed test, so reject the null if the test statistic exceeds the critical value for a given significance level.

One way between groups ANOVA
One-Way ANOVA (ANOVA stands for Analysis of Variance) is used where we wish to test the equality of population means of 3 or more groups. (So it is like an extension of a t-test).
Conditions needed to run a one way ANOVA

• data are normally distributed
• each group has unknown but common variance

One way ANOVA table

 Source Degree of freedom Sum of square(SS) Mean square(MS) F Betwen K-1 B MSB = B / (K-1) MSB / MSW Within n-K W MSW = W / (n-K) Total n-1 SST

The null hypothesis is that population means in each group is equal. Reject the null at a given significance level if the test statistic exceeds the critical value from the F table with degree of freedom K-1(numerator), n-K (denominator):

$\frac{MSB}{MSW} > F_{K-1,n-K, \alpha}$

The quantities in the table are:

K is number of group means being compared
ni is the number of observations in group i
$\bar{x}_{i}$ is the sample mean in group i
$\bar{x}_{ij}$ is the jth observation in group i
$B = \sum_{i=1}^K n_i(\bar{x}_i - \bar{x})^2$
$W = \sum_{i=1}^K \sum_{j=1}^{n_{i}}(x_{ij} - \bar{x}_i)^2$
$SST = B + W$