The chisquaret command will use the χ2 test to compare sample data to a specified distribution. You need to provide chisquaret with the following arguments:
The chisquaret command will return the result of the χ2 test between the sample data and the named distribution or the two sample data.
For example, if you enter
you will get
Guessing data is the list of number of elements in each class, adequation to uniform distribution Sample adequation to a finite discrete probability distribution Chi2 test result 0.0810810810811, reject adequation if superior to chisquare_icdf(1,0.95)=3.84145882069 or chisquare_icdf(1,1-alpha) if alpha!=5% 0.0810810810811
If you enter
you will get
Sample adequation to a finite discrete probability distribution Chi2 test result 0.742424242424, reject adequation if superior to chisquare_icdf(1,0.95)=3.84145882069 or chisquare_icdf(1,1-alpha) if alpha!=5% 0.742424242424
If you enter
you will get
Binomial: estimating n and p from data 10 0.5055 Sample adequation to binomial(10,0.5055,.), Chi2 test result 7.77825189838, reject adequation if superior to chisquare_icdf(7,0.95)=14.0671404493 or chisquare_icdf(7,1-alpha) if alpha!=5% 7.77825189838
and if you enter
you will get
Sample adequation to binomial(11,0.5,.), Chi2 test result 125.617374161, reject adequation if superior to chisquare_icdf(10,0.95)=18.3070380533 or chisquare_icdf(10,1-alpha) if alpha!=5% 125.617374161
For an example using class_min and class_dim, let
If you then enter
or equivalently set class_min to −2 and class_dim to −0.25 in the graphical configuration and enter
you will get
Normal density, estimating mean and stddev from data -0.00345919752912 0.201708100832 Sample adequation to normald_cdf(-0.00345919752912,0.201708100832,.), Chi2 test result 2.11405080381, reject adequation if superior to chisquare_icdf(4,0.95)=9.48772903678 or chisquare_icdf(4,1-alpha) if alpha!=5% 2.11405080381
In this last case, you are given the value of d2 of the statistic D2 = ∑j=1k (nj − ej)/ej, where k is the number of sample classes for classes(L,-2,0.25) (or classes(L)), nj is the size of the jth class, and ej = n pj where n is the size of L and pj is the probability of the jth class interval assuming a normal distribution with the mean and population standard deviation of L.