R/Err_exp.R

Defines functions Err_exp

Err_exp <-function(X){
  J <- colnames(X)
  n <- nrow(X)
  K <- ncol(X)
  p <- apply(X,2,sum) / n
  EO<-array(rep(0,K*K*K),dim=c(K,K,K),dimnames=list(J,J,J))
  for (i in 1 : K) for (j in 1 : K) for(k in 1 : K) {
    EO[i,j,k]<- p[i]*(1- p[j])*p[k]*n
  }
  dimnames(EO) <- list(J,J,J)
  return(EO)
}

Try the mudfold package in your browser

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

mudfold documentation built on Nov. 24, 2022, 5:09 p.m.