# ttest

Hypothesis test for the mean of a sample with unknown standard deviation.

## Syntax

[h,pvalue,ci] = ttest(x,m)

[h,pvalue,ci] = ttest(x,m,name,value)

## Inputs

x
Data sample to be tested.
Type: double
Dimension: vector | matrix
m
Hypothesis mean.
Type: double
Dimension: scalar
name
Name of an option whose value follows. Multiple name/value pairs are allowed. The supported options are alpha and dim.
alpha is the level of significance (default: 0.05).
dim is the dimension on which the test is performed (default: first non-singular dimension).
Type: string
value
Value for the preceeding option name.
Type: double | integer
Dimension: scalar

## Outputs

h
0 if the null hypothesis is accepted. 1 if the null hypothesis is rejected.
pvalue
The p-value of the test.
ci
A 100*(1-alpha)% confidence interval for the population mean.

## Example

Vector ttest example.

x = [7.3 9.4 5.9 6.5 5.5 7 5.3 7.3 2.6 8.7 8.1 2.5 3.9 1.4 0.2 4 6 6.1 10.3 1.2];
[h,pvalue,ci] = ttest(x,5)
h = 0
pvalue = 0.47499
ci = [Matrix] 1 x 2
4.139 6.781