R/robustDA-internal.R

Defines functions .mlefun .eqfun

.eqfun <-
function(R,P,cls){
  K = ncol(P)
  C = max(cls)
  R = matrix(R,nrow=C,byrow=T)
  colSums(R)
}
.mlefun <-
function(R,P,cls){
# MLE function
  #cat('.')
	K = ncol(P)
	C = max(cls)
  R = matrix(R,nrow=C,byrow=T)
	f = 0
	for(i in 1:C){
		Ri = R[i,]
    ni = sum(cls==i)
		f = f + sum(log(P[cls==i,] * matrix(1,ni,1)%*%Ri));
	}
	f
}

Try the robustDA package in your browser

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

robustDA documentation built on Oct. 23, 2020, 5:47 p.m.