mTruncNorm: Moments of truncated normal distribution and the integral in...

Description Usage Arguments Details Value Author(s) See Also

View source: R/int.nct.R

Description

Compute the moments of truncated normal distribution and the integral that appears in the noncentral t-distribution

Usage

1
2
3
4
5
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)

Arguments

r

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.

mu

mean of the normal distribution, before truncating.

sd

SD of the normal distribution, before truncating.

lower

lower truncation point

upper

upper truncation point

approximation

Method of approximation. int2 is exact for integer r and interpolate to noninteger r. laplace uses laplacian approximation. numerical uses nuemerical integration.

integral.only

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.

takeLog

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.

ndiv

number of points with closes integer r to be used in polynomial interpolation.

...

other arguments passed to mTruncNorm.int2

Details

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.

Value

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.

Author(s)

Long Qu

See Also

dt, pt, dt.int2


pi0 documentation built on May 2, 2019, 4:47 p.m.