### 20.5.3 Testing the mean with the T test

The studentt command examines whether data conforms to Student’s distribution. For small sample sizes, the studentt test is preferable to normalt (see Section 20.5.2).

- studentt command takes four mandatory arguments and one optional argument:
  - L, a list, which can be one of:
    - L=[ns,ne] for the sample data information, where ns is the the number of successes and ne is the number of trials ne.
    - L=[m,t], where m is the mean and t is the sample size.
    - L, a data list from a control sample.
  - µ, the mean of the population to or a data list from a control sample.
  - σ, the standard deviation of the population. If the data list from a control sample is provided, then this argument is unnecessary.
  - test, the type of test, one of !=, < or >.
  - Optionally, c, the confidence level (by default 0.05).
- studentt(L,σ,test ⟨,c ⟩) returns the result of a T test. It will return 0 if the test fails, 1 if the test succeeds, and it will display a summary of the test.

#### Examples

studentt([10,20],0.5,0.02,'!=',0.1)

*** TEST RESULT 0 ***
Summary T-Test null hypothesis H0 mu1=mu2, alt. hyp. H1 mu1!=mu2.

Test returns 0 if probability to observe data is less than 0.1
(null hyp. mu1=mu2 rejected with less than alpha probability error)
Test returns 1 otherwise (cannot reject null hypothesis)
Data mean mu1=10, population mean mu2=0.5, degrees of freedom 20
alpha level 0.1, multiplier*stddev/sqrt(sample size)=1.32534*0.02/4.47214

0 |  |  |  |  |  |  |  |  |  |

studentt([0.48,20],0.5,0.1,'<')

*** TEST RESULT 1 ***
Summary T-Test null hypothesis H0 mu1=mu2, alt. hyp. H1 mu1<mu2.

Test returns 0 if probability to observe data is less than 0.05
(null hyp. mu1=mu2 rejected with less than alpha probability error)
Test returns 1 otherwise (cannot reject null hypothesis)
Data mean mu1=0.48, population mean mu2=0.5, degrees of freedom 20
alpha level 0.05, multiplier*stddev/sqrt(sample size)=1.72472*0.1/4.47214

1 |  |  |  |  |  |  |  |  |  |