[R] (no subject)
(Ted Harding)
Ted.Harding at nessie.mcc.ac.uk
Fri Nov 26 17:47:29 CET 2004
On 26-Nov-04 Angela Re wrote:
> Good afternoon,
> 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.
x<-rt(5000,4) # draw a sample from t with df=4
hist(x,breaks=0.5*(-40:40)) # draw histogram with bin-width=0.5
x0<-0.1*(-200,200) # breakpoints for pt plot
lines(x0,dt(x0,4)*5000*0.5) # superimpose the pt plot
DON'T use 'plot' for the last one: it will create a new plot,
while 'lines' (like 'points') adds a plot to an existing plot.
> Other question: what is a quntile function?
(?quantile) Given a distribution P(X <= x) for a random
variable X, the quantile of the distribution corresponding
to probability p (or percentage 100*p) is the value x_p
such that P(X <= x_p) = p (when using percentages it is usually
called the percentile).
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861 [NB: New number!]
Date: 26-Nov-04 Time: 16:47:29
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list