Re: KS Analysis In Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg49290] Re: [mg49286] KS Analysis In Mathematica
- From: "Christos Argyropoulos MD" <chrisarg at medscape.com>
- Date: Mon, 12 Jul 2004 02:11:31 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi, Try the following url http://www.verbeia.com/mathematica/mathecon/othercode.html if you are after for a "Normality" test and other goodies. Alternatively try the following Mathematica Code: ------------------------------------------------------------- Needs["Statistics`DescriptiveStatistics`"]; Needs["Statistics`DataManipulation`"]; Needs["Statistics`ContinuousDistributions`"]; Needs["Statistics`DescriptiveStatistics`"]; Needs["Statistics`ConfidenceIntervals`"]; Needs["Statistics`MultiDescriptiveStatistics`"]; Q[s_] := Module[{r}, Sum[(r - s)^r*(x^r)/r!, {r, 0, Floor[s]}]] F[s_, m_] := Normal[Series[Simplify[(Q[s]^2)/Q[2*s]], {x, 0, m}]] Kolmogorov[d_, m_] := Min[N[Abs[Coefficient[F[m*d, m], x, m]*m!/ (m^m)]], 1] Lillefors[y_List] := Module[{stand, quant, kolm}, stand = Standardize[y]; quant = Transpose[QuantileForm [stand]]; kolm = N[Max[Abs[quant[[1]] - Map[CDF[NormalDistribution[0, 1], #] &, quant[[2]]]]]]] ------------------------------------------------------------- Kolmogorov[d,m] gives the Probability of the Kolmogorov Smirnov Test when the test statistic value is d and the sample tested is of size m. If you want to test whether a list of observations has come from a Normal Distribution with unknow mean and variance, use the function Lillefors[obs] which calculates the P-value based on the Lillefors modification of the KS statistic. Cheers Christos Argyropoulos Sent by Medscape Mail: Free Portable E-mail for Professionals on the Move http://www.medscape.com