Maxima Function
test_mean (x)
test_mean(x,option_1,option_2,...)
This is the mean t-test. Argument x is a list or a column matrix
containing a one dimensional sample. It also performs an asymptotic test
based on the Central Limit Theorem if option 'asymptotic is
true.
Options:
'mean, default 0, is the mean value to be checked.
'alternative, default 'twosided, is the alternative hypothesis;
valid values are: 'twosided, 'greater and 'less.
'dev, default 'unknown, this is the value of the standard deviation when it is
known; valid values are: 'unknown or a positive expression.
'conflevel, default 95/100, confidence level for the confidence interval; it must
be an expression which takes a value in (0,1).
'asymptotic, default false, indicates whether it performs an exact t-test or
an asymptotic one based on the Central Limit Theorem;
valid values are true and false.
The output of function test_mean is an inference_result Maxima object
showing the following results:
'mean_estimate: the sample mean.
'conf_level: confidence level selected by the user.
'conf_interval: confidence interval for the population mean.
'method: inference procedure.
'hypotheses: null and alternative hypotheses to be tested.
'statistic: value of the sample statistic used for testing the null hypothesis.
'distribution: distribution of the sample statistic, together with its parameter(s).
'p_value: p-value of the test.
Examples:
Performs an exact t-test with unknown variance. The null hypothesis is H_0: mean=50 against the one sided alternative H_1: mean<50; according to the results, the p-value is too great, there are no evidence for rejecting H_0.
(%i1) load("stats")$ (%i2) data: [78,64,35,45,45,75,43,74,42,42]$ (%i3) test_mean(data,'conflevel=0.9,'alternative='less,'mean=50); | MEAN TEST | | mean_estimate = 54.3 | | conf_level = 0.9 | | conf_interval = [minf, 61.51314273502712] | (%o3) | method = Exact t-test. Unknown variance. | | hypotheses = H0: mean = 50 , H1: mean < 50 | | statistic = .8244705235071678 | | distribution = [student_t, 9] | | p_value = .7845100411786889
This time Maxima performs an asymptotic test, based on the Central Limit Theorem.
The null hypothesis is H_0: equal(mean, 50) against the two sided alternative H_1: not equal(mean, 50);
according to the results, the p-value is very small, H_0 should be rejected in
favor of the alternative H_1. Note that, as indicated by the Method component,
this procedure should be applied to large samples.
(%i1) load("stats")$ (%i2) test_mean([36,118,52,87,35,256,56,178,57,57,89,34,25,98,35, 98,41,45,198,54,79,63,35,45,44,75,42,75,45,45, 45,51,123,54,151], 'asymptotic=true,'mean=50); | MEAN TEST | | mean_estimate = 74.88571428571429 | | conf_level = 0.95 | | conf_interval = [57.72848600856194, 92.04294256286663] | (%o2) | method = Large sample z-test. Unknown variance. | | hypotheses = H0: mean = 50 , H1: mean # 50 | | statistic = 2.842831192874313 | | distribution = [normal, 0, 1] | | p_value = .004471474652002261