varhat: Asymptotic variance (times n) of the estimator for mu or sigmasq for the univariate truncated normal assuming the other parameter is known.
Description
Asymptotic variance (times n) of the estimator for mu or sigmasq for the univariate truncated normal assuming the other parameter is known.
Usage
varhat(mu, sigmasq, mode, param1, param2, est_mu)
Arguments
mu
A number, the true mu parameter.
sigmasq
A number, the true sigmasq parameter.
mode
A string, the class of the h function.
param1
A number, the first parameter to the h function.
param2
A number, the second parameter (may be optional depending on mode) to the h function.
est_mu
A boolean. If TRUE, returns the asymptotic variance of muhat assuming sigmasq is known; if FALSE, returns the asymptotic variance of sigmasqhat assuming mu is known.
Value
A number, the asymptotic variance.
Details
The estimates may be off from the empirical variance, or may even be Inf or NaN if "mode" is one of "cosh", "exp", and "sinh") as the functions grow too fast.
If est_mu == TRUE, the function numerically calculates
$$E\left[\sigma^2 h^2(X)+\sigma^4 {h'}^2(X)\right]/E^2[h(X)],$$
and if est_mu == FALSE, the function numerically calculates
$$E\left[\left(2\sigma^6h^2(X)+\sigma^8{h'}^2(X)\right)(X-\mu)^2\right]/E^2\left[h(X)(X-\mu)^2\right],$$
where \(E\) is the expectation over the true distribution \(TN(\mu,\sigma)\) of \(X\).