R/network.AIC.R

Defines functions network.AIC

Documented in network.AIC

# 	get AIC for network
network.AIC = function(network, Pm=NULL, k=length(nodes(network$graph)), verbose=TRUE){	
	M <- as(network$graph,"matrix")
	diag(M) = 0
	if(is.null(Pm))
		Pm = matrix(0,ncol=ncol(M),nrow=nrow(M))
	diag(Pm) = 0
	npar <- sum(abs(M - Pm)>0)
	AIC <- -2*network$mLL + k*npar
	if(verbose) 
		cat(paste("==> AIC ( lambda = ",network$lam,") = ",AIC,"( #param =", npar,")===============\n"))
	return(AIC)
}

Try the nem package in your browser

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

nem documentation built on Oct. 31, 2019, 2:12 a.m.