Re: [R] Standard Deviation Distribution

From: Erich Neuwirth <>
Date: Sun 18 Jun 2006 - 21:30:08 EST wrote:
> > sddist

>>> > >>

> > function(s,n) {
> > sig2 <- n*s*s/(n-1)
> > 2*(n/(2*sig2))^((n-1)/2) / gamma((n-1)/2) * exp(-n*s*s/(2*sig2)) *
> > }

There is another way using more statistical knowledge: Building on functions already available in R one may note that the easiest way of defining sddist is

sddist<-function(s,n) dchisq(n*s^2,n-1)*2*n*s

Plotting this function for n in seq(2,12,2) reproduces the graph in Mathworld.

The idea is the following:
given a random variable x with a chisquare distribution with df n-1, s can be defined by s=sqrt(x/n) and therefore x=n*s^2

If F and G are the cumulative distribution functions of x and s and f and g are the density functions of x and s, then we have G(s)=F(n*s^2) and therefore

Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

______________________________________________ mailing list
PLEASE do read the posting guide!
Received on Sun Jun 18 21:34:45 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 18 Jun 2006 - 22:12:09 EST.

Mailing list information is available at Please read the posting guide before posting to the list.