Defines functions siber.ellipses

Documented in siber.ellipses

siber.ellipses <- function(x,y,group,R=10^4) {

# now loop through the data and calculate the ellipses
ngroups <- length(unique(group))

# split the isotope data based on group
spx <- split(x,group)
spy <- split(y,group)

SEA.B <- matrix(data=0,nrow=R,ncol=ngroups)

for (j in 1:ngroups){

  # fit a Multivariate Normal distribution to the data
  model <- bayesMVN(spx[[j]],spy[[j]],R = R)

  # alternatively you could fit two independent normal distributions
  #model <- bayestwoNorm(x,y,R=reps)

  Nobs <- nrow(model$b)

  for (i in 1:Nobs){

    estS <- model$S[i,]
    dim(estS) <- c(2,2)

    SEA.B[i,j] <- popSEA(estS)$SEA





Try the siar package in your browser

Any scripts or data that you put into this service are public.

siar documentation built on May 30, 2017, 2:17 a.m.