Package 'etrunct'

Title: Computes Moments of Univariate Truncated t Distribution
Description: Computes moments of univariate truncated t distribution. There is only one exported function, e_trunct(), which should be seen for details.
Authors: Matthew Stephens
Maintainer: Matthew Stephens <[email protected]>
License: MIT + file LICENSE
Version: 0.1
Built: 2024-11-04 21:42:41 UTC
Source: https://github.com/stephens999/etrunct

Help Index


Compute moments of univariate truncated t distribution

Description

Compute moments of univariate truncated t distribution

Usage

e_trunct(a, b, df, r)

Arguments

a

the left end of the truncation interval

b

the right end of the truncation interval

df

the degrees of freedom of the t distribution

r

the degree of moment to compute

Details

This function computes the r-th moment of the univariate t distribution on df degrees of freedom, truncated to the interval (a,b). If parameters are vectors then the r[i]th moment is computed for each (a[i],b[i],v[i]) The methods are based on results in O'Hagan (1973) and work for df>r. Otherwise NaN is returned.

References

O'Hagan, A. (1973) Bayes estimation of a convex quadratic. Biometrika 60 (3).

Examples

e_trunct(-3,3,3,2) # second moment of t distribution on 3df truncated to (-3,3)
 e_trunct(-2,2,4,1) # first moment, should be 0 by symmetry

 e_trunct(c(-3,-2),c(3,2),c(3,4),c(2,1)) # the function is vectorized