Computes the leverage (hat values) for a RAL estimator. Used internally for HC3 standard errors.
Usage
# S3 method for class 'ral'
hatvalues(model, fit_idx = 1, ...)Details
The leverage for observation \(i\) is
$$h_i(\theta) = -\mathrm{tr}\!\left( \frac{1}{n} \frac{\partial \phi_i(\theta)} {\partial \theta} \right).$$
The sample analog replaces \(\phi_i(\theta)\) with its estimate \(\hat\phi_i\): \(\hat{h}_i = h_i(\hat\theta).\)
The derivative \(\partial \hat\phi_i / \partial \theta\)
is stored in the dinf_dtheta slot. For the specific
form of this derivative in the DML context, see
ddml-intro. For the leverage of linear
combinations, see lincom.