Type: | Package |
Title: | Computes Moments of Univariate Truncated t Distribution |
Version: | 0.1 |
Author: | Matthew Stephens |
Maintainer: | Matthew Stephens <mstephens@uchicago.edu> |
Description: | Computes moments of univariate truncated t distribution. There is only one exported function, e_trunct(), which should be seen for details. |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 5.0.1 |
Suggests: | testthat |
NeedsCompilation: | no |
Packaged: | 2016-07-03 15:43:09 UTC; stephens |
Repository: | CRAN |
Date/Publication: | 2016-07-04 09:12:55 |
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