Estimates the mu and sigma squared parameters from a univariate truncated normal sample.
mu_sigmasqhat(x, mode, param1, param2, mu = NULL, sigmasq = NULL)A vector, the data.
A string, the class of the h function.
A number, the first parameter to the h function.
A number, the second parameter (may be optional depending on mode) to the h function.
A number, may be NULL. If NULL, an estimate will be given; otherwise, the value will be treated as the known true mu parameter and is used to calculate an estimate for sigmasq, if sigmasq is NULL.
A number, may be NULL. If NULL, an estimate will be given; otherwise, the value will be treated as the known true sigmasq parameter and is used to calculate an estimate for mu, if mu is NULL.
A vector that contains the mu and the sigmasq estimates.
If both mu and sigmasq are provided, they are returned immediately. If neither is provided, the estimates are given as $$[1/\sigma^2,\mu/\sigma^2]=\left\{\sum_{i=1}^nh(X_i)[X_i,-1][X_i,-1]^{\top}\right\}^{-1}\left\{\sum_{i=1}^n\left[h(X_i)+h'(X_i)X_i,-h'(X_i)\right]\right\}.$$ If only sigmasq is provided, the estimate for mu is given as $$\sum_{i=1}^n[h(X_i)X_i-\sigma^2 h'(X_i)]/\sum_{i=1}^nh(X_i).$$ If only mu is given, the estimate for sigmasq is given as $$\sum_{i=1}^n h(X_i)(X_i-\mu)^2/\sum_{i=1}^n[h(X_i)+h'(X_i)(X_i-\mu)].$$