R/gen.advance.R

Defines functions gen.advance

Documented in gen.advance

#' Genetic Advance for PRE
#'
#' @param phen_mat phenotypic matrix value of desired characters
#' @param gen_mat genotypic matrix value of desired characters
#' @param weight_mat weight matrix value of desired characters
#' @return Genetic advance of character or character combinations
#' @export
#'
#' @examples
#' gmat<- gen.varcov(seldata[,3:9], seldata[,2], seldata[,1])
#' pmat<- phen.varcov(seldata[,3:9], seldata[,2], seldata[,1])
#' gen.advance(phen_mat = pmat[1,1], gen_mat = gmat[1,1], weight_mat = weight[1,2])
gen.advance<- function(phen_mat, gen_mat, weight_mat)
{
  p<- as.matrix(phen_mat)
  g<- as.matrix(gen_mat)
  w<- as.matrix(weight_mat)
  bmat<- solve(phen_mat) %*% gen_mat %*% weight_mat
  GA<- 2.063 * t(bmat) %*% g %*% w / (t(bmat) %*% p %*% bmat)^0.5
  return(GA)
}

Try the selection.index package in your browser

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

selection.index documentation built on Sept. 19, 2023, 5:09 p.m.