dualbounds.delta.DeltaDualBounds.compute_dual_variables¶
- DeltaDualBounds.compute_dual_variables(y0_dists: list | None = None, y0_vals: ~numpy.array | None = None, y0_probs: ~numpy.array | None = None, y1_dists: list | None = None, y1_vals: ~numpy.array | None = None, y1_probs: ~numpy.array | None = None, verbose: bool = True, min_quantile: float | None = None, ninterp: int | None = None, dual_strategy: str = 'ot', lp_solver: str = 'SCIPY', qp_solver: str = 'CLARABEL', se_solver: str = 'CLARABEL', nvals0: int = 100, nvals1: int = 100, interp_fn: callable = <function adaptive_interpolate>, y0_min: float | None = None, y0_max: float | None = None, y1_min: float | None = None, y1_max: float | None = None, **kwargs)¶
Estimates dual variables using the outcome model.
We generally recommend that the user call .fit() instead of calling this function directly.
- Parameters:¶
- y0_dists : list
The ith distribution of y0_dists represents the conditional law of \(Y_i(0) | X_i\). There are two input formats:
batched scipy distribution of shape (n,)
list of scipy dists whose shapes add up to n.
- y0_vals : list
Alternatively, specify a (n, nvals0)-length array where
y0_vals[i]is the support of \(Y_i(0)\). Ignored ify0_distsis provided.- y0_probs : np.array
A (n, nvals0)-length array where
y0_probs[i, j]is the estimated probability that \(Y_i(0)\) equalsy0_vals[i, j].- y1_dists : list
The ith distribution of y1_dists represents the conditional law of \(Y_i(1) | X_i\). There are two input formats:
batched scipy distribution of shape (n,)
list of scipy dists whose shapes add up to n.
- y1_vals : np.array
(n, nvals1)-length array where
y1_vals[i]is the support of \(Y_i(1)\). Ignored ify1_distsis provided.- y1_probs : np.array
(n, nvals1)-length array where
y1_probs[i, j]is the estimated probability that \(Y_i(1)\) equalsy1_vals[i, j].- dual_strategy : str
Specifies the strategy used to find the dual variables. One of the following:
’ot’: solves a standard-form optimal transport problem.
’lp’: solves a full linear program.
’qp’: solves a quadratic program which approximately accounts for standard errors.
’se’: solves a convex program which exactly accounts for standard errors.
’ot’ is the default and the fastest, but ‘se’ can reduce standard errors in noisy problems.
- lp_solver : str
When
dual_strategy='lp', specifies which cvxpy solver to use to solve the optimal transport LP. Default: SCIPY.- qp_solver : str
When
dual_strategy='qp', specifies which cvxpy solver to use to solve the optimal transport QP. Default: CLARABEL.- se_solver : str
When
dual_strategy='se', specifies which cvxpy solver to use to solve the convex program. Default: CLARABEL.- min_quantile : float
Minimum quantile to consider when discretizing. Defaults to 1 / (2*nvals).
- nvals0 : int
How many values to use to discretize Y(0). Defaults to 100. Ignored for discrete Y.
- nvals1 : int
How many values to use to discretize Y(1). Defaults to 100. Ignored for discrete Y.
- interp_fn : function
An interpolation function with the same input/output signature as
interpolation.adaptive_interpolate, which is the default. Ignored for discrete Y.- y0_min : float
Minimum support for Y(0). Defaults to
self.y.min() - 0.5 * (self.y.max() - self.y.min())- y1_min : float
Minimum support for Y(1). Defaults to
self.y.min() - 0.5 * (self.y.max() - self.y.min())- y0_max : float
Maximum support for Y(0). Defaults to
self.y.max() + 0.5 * (self.y.max() - self.y.min())- y1_max : float
Maximum support for Y(1). Defaults to
self.y.max() + 0.5 * (self.y.max() - self.y.min())- kwargs : dict
kwargs for
_ensure_feasibilitymethod, e.g.,grid_size.
- Return type:¶
None