From: Erich Neuwirth <erich.neuwirth_at_univie.ac.at>

Date: Sun 18 Jun 2006 - 21:30:08 EST

> > 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)) *
*

s^(n-2)

*> > }
*

Date: Sun 18 Jun 2006 - 21:30:08 EST

davidr@rhotrading.com wrote:

> > sddist

>>> > >>

> > function(s,n) {

s^(n-2)

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

g(s)=f(n*s^2)*2*n*s

-- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at http://sunsite.univie.ac.at Phone: +43-1-4277-39464 Fax: +43-1-4277-39459 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlReceived 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 https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*