R/d.binormal.R

#' density of binomial distribution with equal mean and sigma on both dimensions
#'
#' @param z.1 pseudo value for first replicate.
#' @param z.2 pseudo value for second replicate.
#' @param mu the mean of the reproducible component.
#' @param sigma  the standard deviation of the reproducible component.
#' @param rho  the correlation coefficient of the reproducible component.
#' @return the log likelihood of the binomial distribution with equal mean and signma on both dimensions.
#'
d.binormal <- function(z.1, z.2, mu, sigma, rho){

  loglik <- (-log(2)-log(pi)-2*log(sigma) - log(1-rho^2)/2 - (0.5/(1-rho^2)/sigma^2)*((z.1-mu)^2 -2*rho*(z.1-mu)*(z.2-mu) + (z.2-mu)^2))

  return(loglik)
}
qunhualilab/gIDR documentation built on May 14, 2019, 10:38 a.m.