Re: [R] how to plot density distribution with a arrow pointer?

From: Hu Chen <chencheva_at_gmail.com>
Date: Thu 16 Jun 2005 - 11:12:02 EST

Thanks.
A small arrow may be more nice-looking than a long cutting line. and, another question,
how to get the p-value of the position of X0? If the whole distribution is not as regular as norm, chi-square but a strange one, how could I get the X0's p-value?

any functions?

Thanks very much.

On 6/15/05, Jim Brennan <jfbrennan@rogers.com> wrote:
> This is one way not so good
> R>X<-rnorm(1000000)
> R>X0<-.899
> R>plot(density(X))
> R>abline(v=X0)
>
> A better way
>
> R>x<-seq(-5,5,.01)
> R>plot(x,dnorm(x))
> R>plot(x,dnorm(x),type="l",col=2)
> R>abline(v=X0,col=4)
> R>?text
> R>text(X0,.2,paste("P(X<X0) =",signif(pnorm(X0),3)),pos=2)
> R>abline(v=X0,col=4)
>
> If you actually want arrows do ?arrows
> Jim
>
> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Hu Chen
> Sent: June 15, 2005 10:41 AM
> To: R
> Subject: [R] how to plot density distribution with a arrow pointer?
>
> Hi all,
> for example:
> > X<- rnorm(1000)
> > X0 <- 0.899
>
> I want to draw a density distribution plot with a arrow pointer
> indicating the position of X0, meanwhile, giving out the p-value.
>
> any functions?
>
> Thanks very much.
>
> ______________________________________________
> 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
>
>



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 Received on Thu Jun 16 11:16:57 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:43 EST