[R] (no subject)
Rau, Roland
Rau at demogr.mpg.de
Fri Nov 26 17:43:53 CET 2004
Hi
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Angela Re
Sent: Friday, November 26, 2004 5:26 PM
To: r-help at stat.math.ethz.ch
Subject: [R] (no subject)
I'd like to know how to superimpose a Student distribution pt on a
histogram. I think I have to use the plot function but I don,t know the
details.
Other question: what is a quntile function?
Since I am not a statistician, I hope my answers are correct.
The quantile function is the inverse of the cumulative distribution
function. Maybe it is easier with an example:
pnorm(0)
asks how much of the probability mass (bounded between 0 and 1) is
smaller or equal to this value. In this case of the standard normal
distribution (mean 0, var=sd=1), it is just half of it.
If you reverse this process you get back to the "x-value", which is what
the quantile function is doing.
qnorm(0.5)
Does this help for the last question?
Code for superimposing the data:
deg.of.free <- 4
hist(rt(n=500, df=deg.of.free), freq=FALSE, breaks=75, xlim=c(-5,5))
xvalues <- seq(from=-5, to=5, length=200)
lines(x=xvalues, y=dt(xvalues, df=deg.of.free), col="blue", lwd=3)
Finally, just two remarks:
1) Please use a sensible subject line in your message.
2) Is this some kind of homework assignment? (looks like a typical one)
Ciao,
Roland
+++++
This mail has been sent through the MPI for Demographic Rese...{{dropped}}
More information about the R-help
mailing list