delicatessen.estimating_equations.basic.ee_positive_mean_deviation
- ee_positive_mean_deviation(theta, y)
Estimating equations for the positive mean deviation. The estimating equations are
\[\begin{split}\sum_{i=1}^n \begin{bmatrix} 2(Y_i - \theta_2)I(Y_i > \theta_2) - \theta_1 \\ 0.5 - I(Y_i \le \theta_2) \end{bmatrix} = 0\end{split}\]where the first estimating equation is for the positive mean difference, and the second estimating equation is for the median. Notice that this estimating equation is non-smooth. Therefore, root-finding is difficult.
Note
As the derivative of the estimating equation for the median is not defined at \(\hat{\theta}\), the bread (and sandwich) cannot be used to estimate the variance. This estimating equation is offered for completeness, but is not generally recommended for applications.
- Parameters
theta (ndarray, list, vector) – Theta in this case consists of two values. Therefore, initial values like the form of
[0, 0]
are recommended.y (ndarray, list, vector) – 1-dimensional vector of n observed values. No missing data should be included (missing data may cause unexpected behavior when attempting to calculate the positive mean deviation).
- Returns
Returns a 2-by-n NumPy array evaluated for the input
theta
andy
.- Return type
array
Examples
Construction of a estimating equation(s) with
ee_positive_mean_deviation
should be done similar to the following>>> from delicatessen import MEstimator >>> from delicatessen.estimating_equations import ee_positive_mean_deviation
Some generic data to estimate the mean for
>>> y_dat = [1, 2, 4, 1, 2, 3, 1, 5, 2]
Defining psi, or the stacked estimating equations
>>> def psi(theta): >>> return ee_positive_mean_deviation(theta=theta, y=y_dat)
Calling the M-estimation procedure (note that
init
has 2 values now).>>> estr = MEstimator(stacked_equations=psi, init=[0, 0, ]) >>> estr.estimate()
Inspecting the parameter estimates
>>> estr.theta
References
Boos DD, & Stefanski LA. (2013). M-estimation (estimating equations). In Essential Statistical Inference (pp. 297-337). Springer, New York, NY.