swh:1:snp:ffdd0a7d2c8ea15ad41d45b3b178f668bd942287
Tip revision: 80ce80871d172ce0bb60c804a03eeb3a37e1bbd4 authored by Derek Young on 30 May 2010, 00:00:00 UTC
version 0.4.4
version 0.4.4
Tip revision: 80ce808
ellipse.r
ellipse <- function(mu, sigma, alpha=.05, npoints=250,
newplot=FALSE, draw=TRUE, ...) {
es <- eigen(sigma)
e1 <- es$vec%*%diag(sqrt(es$val))
r1 <- sqrt(qchisq(1-alpha,2))
theta <- seq(0,2*pi,len=npoints)
v1 <- cbind(r1*cos(theta),r1*sin(theta))
pts=t(mu-(e1%*%t(v1)))
if (newplot && draw) {
plot(pts, ...)
} else if (!newplot && draw) {
lines(pts, ...)
}
invisible(pts)
}