Main Functions in the Package
There are two main functions in this package: wishmom
and iwishmom
. The former is used to compute \(\mathbb{E}[W^rp_{\lambda}(W)]\) and the latter is used to compute \(\mathbb{E}[W^{-r}p_{\lambda}(W^{-1})]\).
Moments of \(\beta\)-Wishart:
wishmom()
The function wishmom()
computes \(\mathbb{E}\left[\prod_{j=1}^r \mbox{tr}(W^j)^{f_j}W^{iw}\right]\) where \(W \sim W_m^\beta(n, \Sigma)\). When \(iw=0\), it computes \(\mathbb{E}[\prod_{j=1}^r \mbox{tr}(W^j)^{f_j}]\).
Arguments
n
: degrees of freedom of the \(\beta\)-Wishart distributionS
: covariance matrix of the \(\beta\)-Wishart distributionf
: a vector of nonnegative integers \(f_j\) that represents the power for \(\mbox{tr}(W^j)\), \(j=1,\ldots, r\)iw
: Power of \(W\)alpha
: The type of Wishart distribution (\(\alpha=2/\beta\)):1/2
: Quaternion Wishart1
: Complex Wishart2
: Real Wishart (default)
Output
When \(iw=0\), it returns \(\mathbb{E}[\prod_{j=1}^r \mbox{tr}(W^j)^{f_j}]\). When \(iw \neq 0\), it returns \(\mathbb{E}[\prod_{j=1}^r \mbox{tr}(W^j)^{f_j}W^{iw}]\).
Examples
# Example 1: For E[tr(W)^4] with W ~ W_m^1(n,S), where n and S are defined below:
<- 20
n <- matrix(c(25, 49,
S 49, 109), nrow=2, ncol=2)
wishmom(n, S, 4) # iw = 0, for real Wishart distribution
#> [1] 8.705084e+13
# Example 2: For E[tr(W)^2*tr(W^3)*W^2] with W ~ W_m^1(n,S), where n and S, are defined below:
<- 20
n <- matrix(c(25, 49,
S 49, 109), nrow=2, ncol=2)
wishmom(n, S, c(2, 0, 1), 2, 2) # for real Wishart distribution
#> [,1] [,2]
#> [1,] 9.039462e+23 1.956948e+24
#> [2,] 1.956948e+24 4.258714e+24
# Example 3: For E[tr(W)^2*tr(W^3)] with W ~ W_m^2(n,S), where n and S are defined below:
<- 20
n <- matrix(c(25, 49 + 2i,
S 49 - 2i, 109), nrow=2, ncol=2)
wishmom(n, S, c(2, 0, 1), 0, 1) # iw = 0, for complex Wishart distribution
#> [1] 2.078126e+17
# Example 4: For E[tr(W)*tr(W^2)^2*tr(W^3)^2*W] with W ~ W_m^2(n,S), where n, S, are defined below:
<- 20
n <- matrix(c(25, 49 + 2i,
S 49 - 2i, 109), nrow=2, ncol=2)
wishmom(n, S, c(1, 2, 2), 1, 1) # for complex Wishart distribution
#> [,1] [,2]
#> [1,] 3.418999e+41+5.014362e+20i 6.943130e+41-2.833930e+40i
#> [2,] 6.943130e+41+2.833930e+40i 1.532151e+42-2.882805e+22i
Moments of Inverse \(\beta\)-Wishart:
iwishmom()
The function iwishmom()
computes \(\mathbb{E}\left[\prod_{j=1}^r \mbox{tr}(W^{-j})^{f_j}W^{-iw}\right]\) where \(W \sim W_m^\beta(n, \Sigma)\). When \(iw=0\), it computes \(\mathbb{E}[\prod_{j=1}^r \mbox{tr}(W^{-j})^{f_j}]\).
Arguments
n
: degrees of freedom of the \(\beta\)-Wishart distributionS
: covariance matrix of the \(\beta\)-Wishart distributionf
: a vector of nonnegative integers \(f_j\) that represents the power for \(\mbox{tr}(W^{-j})\), \(j=1,\ldots, r\)iw
: Power of \(W^{-1}\)alpha
: The type of Wishart distribution (\(\alpha=2/\beta\)):1/2
: Quaternion Wishart1
: Complex Wishart2
: Real Wishart (default)
Output
When \(iw=0\), it returns \(\mathbb{E}[\prod_{j=1}^r \mbox{tr}(W^{-j})^{f_j}]\). When \(iw \neq 0\), it returns \(\mathbb{E}[\prod_{j=1}^r \mbox{tr}(W^{-j})^{f_j}W^{-iw}]\).
Examples
# Example 1: For E[tr(W^{-1})^2] with W ~ W_m^1(n,S), where n and S are defined below:
<- 20
n <- matrix(c(25, 49,
S 49, 109), nrow=2, ncol=2)
iwishmom(n, S, 2) # iw = 0, for real Wishart distribution
#> [1] 0.0006680892
# Example 2: For E[tr(W^{-1})^2*tr(W^{-3})W^{-2}] with W ~ W_m^1(n,S), where n and S are defined below:
<- 20
n <- matrix(c(25, 49,
S 49, 109), nrow=2, ncol=2)
iwishmom(n, S, c(2, 0, 1), 2, 2) # for real Wishart distribution
#> [,1] [,2]
#> [1,] 1.328434e-10 -6.101692e-11
#> [2,] -6.101692e-11 2.824292e-11
# Example 3: For E[tr(W^{-1})^2*tr(W^{-3})] with W ~ W_m^2(n,S), where n and S are defined below:
<- 20
n <- matrix(c(25, 49 + 2i,
S 49 - 2i, 109), nrow=2, ncol=2)
iwishmom(n, S, c(2, 0, 1), 0, 1) # iw = 0, for complex Wishart distribution
#> [1] 1.17985e-08
# Example 4: For E[tr(W^{-1})*tr(W^{-2})^2*tr(W^{-3})^2*W^{-1}] with W ~ W_m^2(n,S), where n and S are defined below:
<- 30
n <- matrix(c(25, 49 + 2i,
S 49 -2i, 109), nrow=2, ncol=2)
iwishmom(n, S, c(1, 2, 2), 1, 1) # for complex Wishart distribution
#> [,1] [,2]
#> [1,] 1.348928e-21+0.000000e+00i -6.116211e-22+2.496413e-23i
#> [2,] -6.116211e-22-2.496413e-23i 3.004350e-22+0.000000e+00i