Compute the moments of truncated normal distribution and the integral that appears in the noncentral t-distribution
mTruncNorm(r = 1, mu = 0, sd = 1, lower = -Inf, upper = Inf,
approximation = c("int2", "laplace", "numerical"),
integral.only = FALSE, ...)
mTruncNorm.int2(r = as.integer(1), mu = 0, sd = 1, lower = -Inf,
upper = Inf, takeLog = TRUE, ndiv = 8)the order of moments to be computed. It could be noninteger, but has to be nonnegative. This is also the degrees of freedom for the noncentral t-distribution.
mean of the normal distribution, before truncating.
SD of the normal distribution, before truncating.
lower truncation point
upper truncation point
Method of approximation. int2 is exact for integer r and interpolate to noninteger r.
laplace uses laplacian approximation. numerical uses nuemerical integration.
logical. If TRUE, only the integral in noncentral t-distribution is returned. Otherwise, it is normalized to be the rth moments of truncated normal distribution.
logical. If TRUE and r is not an integer, the polyomial interpolation will be on the log scale. But final result is on the original scale.
number of points with closes integer r to be used in polynomial interpolation.
other arguments passed to mTruncNorm.int2
numeric vector. If integral.only is TRUE, this is the integral in the noncentral t-density; otherwise this is the rth moments of truncated normal distribution.
mTruncNorm.int2 uses iterative relation over r to compute the integral iteratively starting from r=0 and r=1 whose analytic results are available.
If r is not an integer, the nearest ndiv nonnegative integer r will be used to do divided difference polynomial interpolation.