R/cond_N.R

Defines functions cond_N

cond_N <- function(j, Sigma, Z , Z_new, diag_element, lower_upper)
{
	p <- ncol(Sigma)
	tmp <- matrix(Sigma[j, -j], 1, p-1)
	tmp1 <- solve(Sigma[-j, -j])

	mu <- tmp %*% tmp1 %*% t(Z[, -j])				
	mu <- as.vector(mu)		 
	sigma <- Sigma[j, j] - tmp %*% tmp1 %*% t(tmp)
	sigma <- sqrt(sigma)  		
		  
	obj <- element_S( lower= lower_upper$lower[ ,j], upper= lower_upper$upper[ ,j], mu=mu, sigma=sigma)      

	Z_new <- obj$EX
	diag_element <- mean(obj$EXX)
	
	rm(tmp, tmp1, mu, sigma, obj )
	gc()
	
	return(list(Z_new=Z_new, diag_element=diag_element))
}

Try the epistasis package in your browser

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

epistasis documentation built on May 2, 2019, 5:09 a.m.