Calculates the optimal value of lhat for the prediction-powered confidence interval for GLMs.
calc_lhat_glm(
grads,
grads_hat,
grads_hat_unlabeled,
inv_hessian,
coord = NULL,
clip = FALSE
)(float): Optimal value of lhat in [0,1].
(matrix): n x p matrix gradient of the loss function with respect to the parameter evaluated at the labeled data.
(matrix): n x p matrix gradient of the loss function with respect to the model parameter evaluated using predictions on the labeled data.
(matrix): N x p matrix gradient of the loss function with respect to the parameter evaluated using predictions on the unlabeled data.
(matrix): p x p matrix inverse of the Hessian of the loss function with respect to the parameter.
(int, optional): Coordinate for which to optimize lhat.
If None, it optimizes the total variance over all coordinates.
Must be in (1, ..., d) where d is the shape of the estimand.
(boolean, optional): Whether to clip the value of lhat to be
non-negative. Defaults to False.