ellipse: Generate ellipses

Description Usage Arguments Value Author(s) Examples

Description

Given the axes a, b (major and minor) and angle phi (in radian, counter clockwise from x-axis), and the midpoint c(0,0), points on a rotated ellipse will be generated. The major axis is rotated from the positive x-axis by the angle phi.

Usage

1
2
3
  ellipseC(mid, a, b=a, ra=c(-1,361), phi=0, k=a*100 )
  ellipse1( a, b=a, ra=c(-1,361), phi=0, k=a*100 )
  conf.ellipse( a, b, phi, df1, df2, level = 0.95, k)

Arguments

mid

Complex, center of ellipse

b

Real > 0, minor axis

a

Real > 0, major axis

ra

Integer, range of arc [deg]

phi

Real, angle in radian describing the counter clockwise rotation
from the x-axis to the axis given by 'a'.

k

Integer, the number of generated points on the ellipse.

df1, df2, level

degrees of freedom and probability level
of F-distribution.

Value

ellipseC complex coordinates of the ellipse. ellipse1 (x,y)-coordinates of the ellipse. conf.ellipse (x,y)-coordinates of the confidence ellipse according to
qf(level, df1, df2), see qf.

Author(s)

Christian W. Hoffmann <christian@echoffmann.ch>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
  opar <- par(mfrow=c(1,1))
  k <- 60; m <- c(0,0); a <- 2; b <- 1; phi <- pi/7
  df1 <- 2; df2 <- 20
# show F for different confidence levels:
  p <- c(0.5, 0.75, 0.8, 0.95)
  qf(p, df1, df2) #  0.717735 1.486984 1.746189 3.492828
  el7 <- conf.ellipse(a,b,phi,df1,df2,p[2], k) + m
  plot(el7*1.8,type="n",xlab="Different confidence ellipses",ylab="")
  lines(conf.ellipse(a,b,phi,df1,df2,p[1],60) + m,lty=2,col="red")
  lines(conf.ellipse(a,b,phi,df1,df2,p[3],60) + m,lty=2,col="green")
  lines(conf.ellipse(a,b,phi,df1,df2,p[4],60) + m,lty=2,col="blue")
  lines(el7,lty=2,col="orange")
  leg1 <- paste(as.character(p*100),rep("percent",length(p)),sep="")
#  leg1 <- paste(as.character(p*100),rep("%",length(p)),sep="")
  col1 <- c("red", "orange","green","blue")
  legend(x="bottom",leg1,col=col1,
text.col="black",lty=c(2,2,2,2), merge=TRUE, bg='white', cex=0.9)
par(opar)
for(ii in 0:15){ x <- ellipseC(40,1,2,phi=pi/15*ii);lines(x,col=ii%%3+1)}

cwhmisc documentation built on May 1, 2019, 7:55 p.m.