Re: Re: KS Analysis In Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg49321] Re: [mg49309] Re: KS Analysis In Mathematica
- From: Mark Coleman <mark at markscoleman.com>
- Date: Wed, 14 Jul 2004 07:29:26 -0400 (EDT)
- References: <cctadj$c0u$1@smc.vnet.net> <200407130832.EAA09623@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Doug, If this is of interest, here is code for the Bera-Jarque test of normality. The module takes the data to be tested as an argument and returns a two-element list consisting of the Bera-Jarque statistic and it's p-value. Needs["Statistics`DescriptiveStatistics`"]; Clear[beraJarque]; beraJarque[d_] := Module[{s, k, n, bj, bjsig}, n = Length[d]; s = Skewness[d]; k = KurtosisExcess[d]; bj = (n/6)*s^2 + (n/24)*k^2; bjsig = 1.0 - CDF[ChiSquareDistribution[2], bj]; {bj, bjsig} ] Regards, Mark On Jul 13, 2004, at 4:32 AM, Doug wrote: > The links to the stats packages don't work....and neither does the > contact > info to these people > ??? > > Doug > "Christos Argyropoulos MD" <chrisarg at medscape.com> wrote in message > news:cctadj$c0u$1 at smc.vnet.net... >> 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 >> > > >
- References:
- Re: KS Analysis In Mathematica
- From: "Doug" <umdougmm@hotmail.com>
- Re: KS Analysis In Mathematica