Estimate parameters of the normal distribution accounting for censoring

Mean and standard deviation of a normal distribution are estimated based on maximum likelihood estimation. For samples above the LLOQ, the likelihood is determined from the normal density dnorm(x, mean, sd). For values below the LLOQ, the likelihood is the integrated density pnorm(x, mean, sd). Mean and standard deviation are estimated by optimization of -2 LL.

norm_M3(x, LLOQ = -Inf, return_LLOQ = -Inf)

Arguments

x

numeric vector, the normally distributed sample. Censored values should be coded by numbers <= LLOQ.

LLOQ

value or numeric valus of length of x indicating the lower limit of quantification (left censoring).

return_LLOQ

numeric, the return value for the case that all elements of x are below LLOQ.

Value

List with mean (mean) and standard deviation (sd).

Details

The return values for mean and standard deviation are the estimated mean and N/(N-1) times the estimated standard deviation, where N is the length of the sample. I.e., the Bessel corrected standard deviation is returned.

Examples

if (FALSE) { # \dontrun{
norm_M3(rnorm(10000), LLOQ = -Inf, return_LLOQ = -Inf)
norm_M3(rnorm(10000), LLOQ = 0, return_LLOQ = -Inf)
x <- rnorm(10000)
x[x<0] <- 0
norm_M3(x, LLOQ = 0, return_LLOQ = -Inf)
} # }