Reputation: 197
I want to compute inverse moments and truncated inverse moments of a non-central chi-square distribution in R. How can I do that in R?
Suppose X follows the non-central chi-square distribution with degrees of freedom "k" and non-centrality parameter "t". My problem is to numerically compute the following expectations for various values of "t" so I can simulate the risk of James-Stein type estimators.
(i) E[X^(-1)] and E[X^(-2)]
(ii) E[X^(-1)I(A)] where I(A) is an indicator function of set A
(iii) E[1-c{X^(-2)}I(A)] where c is a constant.
Upvotes: 1
Views: 911
Reputation: 206
Paolella's book, Intermediate Probability gives the moments of the non-central chi-square to various powers. See equation (10.10). You can find R code for these in the sadists package.
Upvotes: 0
Reputation: 44340
In general, you can numerically compute the expected value of a random variable by drawing a large number of samples and then averaging them. For instance, you could estimate the expected values of X^(-1) and X^(-2) with something like:
mean(rchisq(1000000, df=3, ncp=10)^-1)
# [1] 0.1152163
mean(rchisq(1000000, df=3, ncp=10)^-2)
# [1] 0.1371877
Upvotes: 2