delicatessen.estimating_equations.basic.ee_mean
- ee_mean(theta, y, weights=None)
Estimating equation for the mean. The estimating equation for the mean is
\[\sum_{i=1}^n (Y_i - \theta) = 0\]For the weighted mean, the difference in the previous estimating equation is multiplied by the corresponding weight.
- Parameters
theta (ndarray, list, vector) – Theta in the case of the mean consists of a single value. Therefore, an initial value like the form of
[0, ]should be provided.y (ndarray, list, vector) – 1-dimensional vector of n observed values.
weights (ndarray, list, vector, None, optional) – 1-dimensional vector of n weights. Default is
None, which assigns a weight of 1 to all observations.
- Returns
Returns a 1-by-n NumPy array evaluated for the input
thetaandy- Return type
array
Examples
Construction of a estimating equation(s) with
ee_meanshould be done similar to the following>>> from delicatessen import MEstimator >>> from delicatessen.estimating_equations import ee_mean
Some generic data to estimate the mean for
>>> y_dat = [1, 2, 4, 1, 2, 3, 1, 5, 2]
Defining psi, or the estimating equation
>>> def psi(theta): >>> return ee_mean(theta=theta, y=y_dat)
Calling the M-estimator
>>> estr = MEstimator(stacked_equations=psi, init=[0, ]) >>> estr.estimate()
Inspecting the parameter estimates, the variance, and the asymptotic variance
>>> estr.theta >>> estr.variance >>> estr.asymptotic_variance
References
Boos DD, & Stefanski LA. (2013). M-estimation (estimating equations). In Essential Statistical Inference (pp. 297-337). Springer, New York, NY.