How can I write a Matlab function “chi2test”, which will be used to carry out the hypothesis testing for population variance. The prototype of the function is
[h, chi2value, df] = chi2test(sample, var0, alpha, tail)
where
h = Conclusion of the test. The value 0 indicates rejection the null hypothesis. Otherwise, return the
value 1.
chi2value = The value of test statistic.
df = The degrees of freedom of the 2 distribution if the H0 is true.
sample = The sample data for the test.
var0 = The assumed population variance in the H0.
alpha = The level of signiﬁcance of the test.
tail = The value 0 indicates a two-tailed test. The value 1 indicates a lower-tailed test. The value +1 indicates a upper-tailed test. Otherwise, print “error”.

## Comments

## Leave a comment