p <- seq(0.001,0.999,,1000) x <- qt(p,df=9) y <- dt(x,df=9) plot(x,y,type="l") polygon(x=c(x,rev(x)),y=c(y,rep(0,length(y))),col="gray90")
Hope this helps. ST --- "Nair, Murlidharan T" <[EMAIL PROTECTED]> wrote: > Indeed, this is what I wanted, I figured it from the function you and > Mark pointed me. Thank you both. > > I am trying to plot it to illustrate the point and I tried this > > plot(function(x) dt(x, df = 9), -5, 5, ylim = c(0, 0.5), main="t - > Density", yaxs="i") > > Is there an easy way to shade the area under the curve? > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > [EMAIL PROTECTED] > Sent: Wednesday, August 01, 2007 3:18 PM > To: [EMAIL PROTECTED]; r-help@stat.math.ethz.ch > Subject: Re: [R] t-distribution > > Well, is "t = 1.11" all that accurate in the first place? :-) > > In fact, reading beween the lines of the original enquiry, what the > person probably wanted was something like > > ta <- pt(-1.11, 9) + pt(1.11, 9, lower.tail = FALSE) > > which is the two-sided t-test tail area. > > The teller of the parable will usually leave some things unexplained... > > Bill. > > > Bill Venables > CSIRO Laboratories > PO Box 120, Cleveland, 4163 > AUSTRALIA > Office Phone (email preferred): +61 7 3826 7251 > Fax (if absolutely necessary): +61 7 3826 7304 > Mobile: +61 4 8819 4402 > Home Phone: +61 7 3286 7700 > mailto:[EMAIL PROTECTED] > http://www.cmis.csiro.au/bill.venables/ > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Ben Bolker > Sent: Thursday, 2 August 2007 4:57 AM > To: r-help@stat.math.ethz.ch > Subject: Re: [R] t-distribution > > <Bill.Venables <at> csiro.au> writes: > > > > > for the upper tail: > > > > > 1-pt(1.11, 9) > > [1] 0.1478873 > > > wouldn't > pt(1.11, 9, lower.tail=FALSE) > be more accurate? > > ______________________________________________ > 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.html > and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ > 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.html > and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ > 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.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ 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.html and provide commented, minimal, self-contained, reproducible code.