# Hypothesis Testing Package

This package contains functions for computing confidence intervals from data and

p-values and confidence intervals for distributions related to the normal distribution.

## Distributional -Values

Given a test statistic in terms of the normal,

, Student's

t, or

F-ratio distribution, a

p-value can be computed using the appropriate

p-value function. For example,

NormalPValue computes a

p-value for a test statistic using a normal distribution with mean zero and unit variance. A two-sided

p-value can be obtained by setting

TwoSided->True.

NormalPValue[teststat] | give the p-value for teststat in terms of the normal distribution with mean 0 and unit variance |

StudentTPValue[teststat,dof] | give the p-value for teststat in terms of Student's t distribution with dof degrees of freedom |

ChiSquarePValue[teststat,dof] | give the p-value for teststat in terms of the distribution with dof degrees of freedom |

FRatioPValue[teststat,numdof,dendof] | give the p-value for teststat in terms of the F-ratio distribution with numdof numerator and dendof denominator degrees of freedom |

Functions for -values of test statistics.

This is the lower tail probability at -1.96 for a normal distribution with mean

and unit variance.

Out[9]= | |

A

TwoSidedPValue gives the probability of the absolute value of the test statistic being at least as extreme as

.

Out[10]= | |

A

p-value is not always equivalent to the cumulative distribution function.

Out[11]= | |

A one-sided

p-value has a maximum value of

.

Out[12]= | |

A two-sided

p-value is twice the one-sided

p-value.

Out[13]= | |

## Confidence Intervals

A confidence interval gives bounds within which a parameter value is expected to lie with a certain probability. Interval estimation of a parameter is often useful in observing the accuracy of an estimator as well as in making statistical inferences about the parameter in question.

MeanCI and

MeanDifferenceCI provide confidence intervals of means and differences of means based on the central limit theorem.

MeanCI[list] | give a confidence interval for the population mean estimated from list |

MeanDifferenceCI[list_{1},list_{2}] | give a confidence interval for the difference between the population means estimated from and |

Confidence intervals for means.

Here is a list of sample values.

This gives a 95% confidence interval for the mean.

Out[25]= | |

Assumptions about variances of the populations from which the data were sampled will affect the distribution of the parameter estimate. The

KnownVariance and

EqualVariances options can be used to specify assumptions about population variances.

Option for MeanCI and MeanDifferenceCI.

Confidence intervals for the mean and for the difference between means are based on a normal distribution if the population variances are assumed known.

Intervals for the mean are based on Student's

t-distribution with

degrees of freedom when the population variance must be estimated from a list of

n elements.

Here is a confidence interval for the mean assuming a population variance of

.

Out[27]= | |

Option for MeanDifferenceCI.

Confidence intervals for the difference between means are also based on Student's

t distribution if the variances are not known. If the variances are assumed equal,

MeanDifferenceCI is based on Student's

t distribution with

Length[list_{1}]+Length[list_{2}]-2 degrees of freedom. If the population variances are not assumed equal, Welch's approximation for the degrees of freedom is used.

This is a second dataset.

This gives a 95% confidence interval for the difference between means.

Out[31]= | |

This gives the confidence interval assuming equal population variances.

Out[32]= | |

VarianceCI and

VarianceRatioCI provide tests of variances for normally distributed samples.

VarianceCI[list] | give a confidence interval for the population variance estimated from list |

VarianceRatioCI[list_{1},list_{2}] | give a confidence interval for the ratio of the population variances estimated from and from |

Confidence intervals for variances.

The variance confidence interval is based on a

distribution and the variance ratio confidence interval is based on an

F-ratio distribution.

Here is a variance confidence interval for

.

Out[33]= | |

The default confidence level for confidence interval functions is

. Other levels can be specified via the

ConfidenceLevel option.

Option for all confidence interval functions.

Here is a 90% confidence interval for the population variance of the first sample.

Out[34]= | |

Given an estimate of the mean, variance, or ratio of variances and necessary standard deviations or degrees of freedom, confidence intervals can also be obtained for normal, chi-square, Student

t, or

F-ratio distributions.

NormalCI[mean,sd] | give the confidence interval centered at mean with standard deviation sd |

StudentTCI[mean,se,dof] | give the confidence interval centered at mean with standard error se and dof degrees of freedom |

ChiSquareCI[variance,dof] | give the confidence interval for the population variance given the sample variance variance and dof degrees of freedom |

FRatioCI[ratio,numdof,dendof] | give the confidence interval for the ratio of population variances, given the ratio of sample variances ratio and where the sample variances in the numerator and denominator have numdof and dendof degrees of freedom |

Confidence intervals given sample estimates.

This calculates the mean of

.

Out[35]= | |

This estimates the standard error of the mean.

Out[36]= | |

This is equivalent to

MeanCI for

.

Out[38]= | |