R/sginit.R

sginit <-
function(p,G,x,mug,zmat,n,ng){
	sg <- array(0, dim=c(p, p, G))
#	for(g in 1:G){
#		for(i in 1:n){
#			xminus <- x[i,]-mug[g,]
#			sg[,,g] <- sg[,,g] + (zmat[i,g]/ng[g])*(xminus%*%t(xminus))
#		}
#	}
	for(g in 1:G){
		sg[,,g] <- cov.wt(x,wt=zmat[,g],method="ML")$cov
	}
	sg 
}

Try the mmtfa package in your browser

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

mmtfa documentation built on May 2, 2019, 1:45 p.m.