# [R] t-distribution

Nair, Murlidharan T mnair at iusb.edu
Thu Aug 2 16:20:38 CEST 2007

```How do I tell it to shade a particular region below the curve? Like the
one being computed below
ta <- pt(-1.11, 9) + pt(1.11, 9, lower.tail = FALSE)

Thanks ../Murli

-----Original Message-----
From: Stephen Tucker [mailto:brown_emu at yahoo.com]
Sent: Thursday, August 02, 2007 2:27 AM
To: Nair, Murlidharan T; r-help at stat.math.ethz.ch
Subject: Re: [R] t-distribution

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" <mnair at iusb.edu> 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: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of
> Bill.Venables at csiro.au
> Sent: Wednesday, August 01, 2007 3:18 PM
> To: bolker at ufl.edu; r-help at 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:Bill.Venables at csiro.au
> http://www.cmis.csiro.au/bill.venables/
>
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Ben Bolker
> Sent: Thursday, 2 August 2007 4:57 AM
> To: r-help at 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 at 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 at 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 at 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.
>

________________________________________________________________________
____________
Moody friends. Drama queens. Your life? Nope! - their life, your story.
Play Sims Stories at Yahoo! Games.
http://sims.yahoo.com/

```

More information about the R-help mailing list