MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Normality test

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107471] Re: [mg107204] Re: Normality test
  • From: michael partensky <partensky at gmail.com>
  • Date: Sat, 13 Feb 2010 05:25:07 -0500 (EST)
  • References: <hk8nns$8jv$1@smc.vnet.net> <hk93dv$f7b$1@smc.vnet.net>

Thanks, Ray.
Michael

On Fri, Feb 5, 2010 at 3:24 AM, Ray Koopman <koopman at sfu.ca> wrote:

> Here, prompted by off-line conversations, is an improved version of
> qqnorm:
>
> qqnorm2[data_] := Block[{n, y,y1,y2,y3, x,x1,x2,x3, b,a},
> n = Length@data; y = Sort@data; {y1,y2,y3} = Quartiles@y;
> x = InverseErf[Range[1-n,n-1,2]/(n+.33(n-1.25)^-.1)]*Sqrt[2.];
> {x1,x2,x3} = Quartiles@x; b = (y3-y1)/(x3-x1); a = y1 - b*x1;
> ListPlot[Transpose@{x,y}, PlotRange->All, Frame->True, Axes->None,
> AspectRatio->((Last@y-First@y)/(y3-y1))/((Last@x-First@x)/(x3-x1)),
> Prolog->Line[{#,#*b+a}&/@{First@x,Last@x}],
> FrameLabel->{"Standard Normal","Observed Data"}]]
>
> The most notable changes are that the reference line is now drawn so
> that it passes through the joint first and third quartile points, and
> the aspect ratio now varies so that the visual slope of the reference
> line is always approximately 1. Also, the normal scores are now a
> better approximation of the expected order statstics.
>
> On Feb 2, 3:48 am, Ray Koopman <koop... at sfu.ca> wrote:
> > On Feb 2, 12:28 am, michael partensky <parten... at gmail.com> wrote:
> >> Hi.
> >> I wonder if anybody knows a function similar to qqnorm(data) from
> >> *R*, producing a normal scores plot, or some related tools in M.
> >> for testing normality of data?
> >>
> >> Thanks
> >> Michael Partenskii
> >
> > qqnorm[y_] := Block[
> >  {n = Length@y, m = Mean@y, s = StandardDeviation@y, x},
> >  x = InverseErf[Range[1-n,n-1,2]/n]*Sqrt[2.];
> >  ListPlot[Transpose@{x,Sort@y},
> >  PlotRange->All, Frame->True, Axes->None, AspectRatio->1,
> >  Prolog->Line[{{x[[1]],x[[1]]*s+m},{x[[-1]],x[[-1]]*s+m}}],
> >  FrameLabel->{"Theoretical Standard Normal Quantiles",
> >               "Observed Quantiles"}]]
>
>


  • Prev by Date: Re: Covariant derivatives of tensors?
  • Next by Date: Re: Upright \[Micro] in AxesLabel
  • Previous by thread: Re: Normality test
  • Next by thread: Re: Re: Normality test