R/wright-fisher.R

#' wright fishers model copied from somewhere
#'
#' @author Brian Masinde
#'
#'

wright_fisher <- function(N){
  # initialize the martrix
  P <- matrix(NA, ncol = 2*N + 1, 2*N + 1)

  # fill up the matrix
  for(i in 0:(2*N)){
    for(j in 0:(2*N)){
      # add to matrix for examples
      P[i+1, j+1] <- dbinom(j, 2*N, (i / (2*N)))
    }
  }
  return(round(P, digits = 2))
}
BMasinde/bioinfo documentation built on May 5, 2019, 7:06 a.m.