[R] R: polygon error?

From: Guazzetti Stefano <Stefano.Guazzetti_at_ausl.re.it>
Date: Sat, 26 May 2007 13:04:52 +0200


It seems to me that you are using polygon in a wrong way. What you probably need could be something like:  

polygon(c(rev(t$z), t$z),

         c(rep(0, nrow(t)), t$ht), col=2, border=NA)

Stefano
-----Messaggio originale-----
Da: r-help-bounces_at_stat.math.ethz.ch
[mailto:r-help-bounces_at_stat.math.ethz.ch]Per conto di LL Inviato: sabato 26 maggio 2007 12.34
A: r-help_at_stat.math.ethz.ch
Oggetto: [R] polygon error?

Hi.. I'm not sure why polygon returns an area above the standard normal curve.

z <- pretty(c(-3,3), 100)
ht <- dnorm(z)
data <- data.frame(z=z, ht=ht)
zc <- 1.645
plot(data, type="l")
lines(data)
t <- subset(data, z>zc)
polygon(t, col="red")

Thanks,
Lance

        [[alternative HTML version deleted]]



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. Received on Sat 26 May 2007 - 11:11:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 26 May 2007 - 12:31:02 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.