Re: [R] polygon error?

From: LL <Lbrannma_at_yahoo.com>
Date: Sat, 26 May 2007 14:11:13 +0200


Ok.. I see that I did not completely define the polygon. The code below works fine

z <- pretty(c(-3,3), 100)
ht <- dnorm(z)
data <- data.frame(z=z, ht=ht)
zc <- 1.645
plot(data, type="n")
lines(data)
#segments(160,0,160,dnorm(160, m=160, sd=17), lty=2) t <- subset(data, data$z>zc)
xvals <- t$z
dvals <- t$ht
polygon(c(xvals,rev(xvals)),c(rep(0,length(xvals)),rev(dvals)),col="red")

  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. Received on Sat 26 May 2007 - 12:15:35 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 - 18:31:46 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.