R/canopy.cluster.Mstep.R

Defines functions canopy.cluster.Mstep

Documented in canopy.cluster.Mstep

# Maximization function
canopy.cluster.Mstep = function (pG,R,X,Tau_Kplus1){
    s=nrow(R) # number of mutations
    K=nrow(pG)-1 # number of mutation clusters
    Tau=rep(NA,K+1)
    Tau[1:K]=(1-Tau_Kplus1)*apply(pG[1:K,],1,sum)/(s-sum(pG[K+1,]))
    Tau[K+1]=Tau_Kplus1
    pGtemp=pG[1:K,]
    Mu=(pGtemp%*%R)/(pGtemp%*%X)
    Mu=round(pmax(Mu,0.0001),4)
    return(list(Mu=Mu,Tau=Tau))
}

Try the Canopy package in your browser

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

Canopy documentation built on Dec. 23, 2017, 5:09 p.m.