likelihood | R Documentation |
Probability density for a truncated Normal distribution with mean equal to location
and standard deviation equal to scale
.
likelihood(
biphasic = FALSE,
param.name = NULL,
rj.obj,
values = NULL,
included.cov = NULL,
RJ = FALSE,
lprod = TRUE
)
biphasic |
Logical. Indicates the type of model for which likelihoods should be calculated. |
param.name |
Paramter name. Ignored if |
rj.obj |
rjMCMC object. |
values |
List of proposed values, if available. |
included.cov |
Boolean vector indicating which contextual covariates are included in the current iteration of the rjMCMC sampler. |
RJ |
Logical. If |
lprod |
If |
x |
Vector of quantiles. |
location |
Vector of means. |
scale |
Vector of standard deviations. |
log |
Logical. If |
L |
Lower limit of the distribution. |
U |
Upper limit of the distribution. dtnorm <- function(x, location = 0, scale = 1, log = FALSE, L = -Inf, U = Inf) d <- dnorm(x, location, scale, log = TRUE) denom <- log(pnorm(U, location, scale) - pnorm(L, location, scale)) d <- d - denom d(x < L) | (x > U) <- -100000 # When input quantile is outside bounds dis.infinite(d) <- -100000 # When input location is outside bounds if(!log) d <- exp(d) return(d) #' The Truncated Normal Distribution
#'
#' Generate random deviates from a truncated normal distribution with mean equal to rtnorm <- function(n, location, scale, L, U) location + scale * qnorm(pnorm(L, location, scale) + runif(n)*(pnorm(U, location, scale) - pnorm(L, location, scale))) d_binom <- function(x, size, prob, log) d <- dbinom(x = x, size = size, prob = prob, log = log) dis.infinite(d) <- -100000 # To avoid Inf that cause numerical issues return(d) Likelihood Calculate the log-likelihood of a monophasic dose-response model, as required by the rjMCMC sampler. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.