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.
- m
- Hypothesis mean.
- name
- Name of an option whose value follows. Multiple name/value pairs are allowed. The supported options are alpha and dim.
- value
- Value for the preceeding option name.
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
Comments
ttest is a 1 sample t test and assumes that the sample comes from a normally distributed population. The null hypothesis is that the hypothesized mean is the population mean.
The paired t test is not supported by ttest at this time.