[R] t-distribution
Stephen Tucker
brown_emu at yahoo.com
Thu Aug 2 21:11:15 CEST 2007
yes, or
p <- seq(0.001,0.999,,1000)
x <- qt(p,df=9)
y <- dt(x,df=9)
plot(x,y,type="l")
f <- function(x,y,...) {
polygon(x=c(x,rev(x)),y=c(y,rep(0,length(y))),...)
}
with(data.frame(x,y)[x >= 2.3,],f(x,y,col="gray90"))
with(data.frame(x,y)[x <= -2.3,],f(x,y,col="gray90"))
--- "Nair, Murlidharan T" <mnair at iusb.edu> wrote:
>
> I tried doing it this way.
>
> left<--2.3
> right<-2.3
> p <- seq(0.001,0.999,,1000)
> x <- qt(p,df=9)
> y <- dt(x,df=9)
> plot(x,y,type="l")
> x.tmp<-x
> y.tmp<-y
> a<-which(x<=left)
>
polygon(x=c(x.tmp[a],rev(x.tmp[a])),y=c(y.tmp[a],rep(0,length(y.tmp[a]))),col="gray90")
> b<-which(x>=right)
>
polygon(x=c(x.tmp[b],rev(x.tmp[b])),y=c(y.tmp[b],rep(0,length(y.tmp[b]))),col="gray90")
>
> Please let me know if I have made any mistakes.
> Thanks ../Murli
>
>
>
> -----Original Message-----
> From: Richard M. Heiberger [mailto:rmh at temple.edu]
> Sent: Thu 8/2/2007 10:25 AM
> To: Nair, Murlidharan T; Stephen Tucker; r-help at stat.math.ethz.ch
> Subject: Re: [R] t-distribution
>
> I believe you are looking for the functionality I have
> in the norm.curve function in the HH package.
>
> Download and install HH from CRAN and then look at
>
> example(norm.curve)
>
>
____________________________________________________________________________________Ready for the edge of your seat?
Check out tonight's top picks on Yahoo! TV.
More information about the R-help
mailing list