Compute the covariance matrix of \(M\) and \(S\) given \(q_\mathrm{min}\). Define the vector of four moment expectations
$$E_{i\in 1,2} = \Psi\bigl(\Phi^{(-1)}(q_\mathrm{min}), i\bigr)\mbox{,}$$
where \(\Psi(a,b)\) is the gtmoms
function and \(\Phi^{(-1)}\) is the inverse of the standard normal distribution. Define the scalar quantity \(Es = \) EMS(n,r,qmin)[2]
as the expectation of \(S\) using the EMS
function, and define the scalar quantity \(E_s^2 = E_2 - E_1^2\) as the expectation of \(S^2\). Finally, compute the covariance matrix \(COV\) of \(M\) and \(S\) using the V
function:
$$COV_{1,1} = V_{1,1}\mbox{,}$$
$$COV_{1,2} = COV_{2,1} = V_{1,2}/2Es\mbox{,}$$
$$COV_{2,2} = E_s^2 - (E_s)^2\mbox{.}$$