confEllipse: Plot confidence ellipse based on two-dimenstional data

View source: R/ellipse.R

confEllipseR Documentation

Plot confidence ellipse based on two-dimenstional data

Description

Plot confidence ellipse based on two-dimenstional data

Usage

confEllipse(x, y = NULL, conf = 0.95, ...)

Arguments

x

either a matrix of two columns, or a numeric vector

y

either a numeric vector of the same length as x, or NULL

conf

Confidence interval of the ellipse

...

Parameters passed to ellipse

Value

Invisible coordinates of points on the ellipse

Examples



if(interactive()) {
  testX <- rnorm(100, mean=1, sd=2)
  testY <- rnorm(100, mean=2, sd=3)
  plot(testX, testY, pch=16, xlim=c(-5,7), ylim=c(-7,11))
  confEllipse(testX, testY, col="red", lwd=1)
  confEllipse(testX, testY, conf=0.99, col="red", lwd=2)
  confEllipse(testX, testY, conf=0.9, col="red", lwd=0.5)
}

if(interactive() & require("MASS")) {
  testMVR <- mvrnorm(n=100, mu=c(2,3), Sigma=matrix(c(1, 0.65, 0.65, 1), nrow=2))
  plot(testMVR, pch=16, xlim=c(-2,6), ylim=c(0,6))
  confEllipse(testMVR, col="orange")
  confEllipse(testMVR, conf=0.99, col="red")
  confEllipse(testMVR, conf=0.9, col="lightblue")
}



bedapub/ribiosPlot documentation built on Sept. 1, 2023, 6:50 p.m.