API References
Function Gallery of the Debiasing Inference Method
- debiasing.debias_prog.DebiasProg(X, x, Pi, gamma_n=0.1)[source]
The proposed Debiasing (primal) program.
- Parameters:
X ((n,d)-array) – The input design matrix.
x ((d,)-array) – The current query point.
Pi ((n,n)-array) – A diagonal matrix with (estimated) propensity scores as its diagonal entries.
gamma_n (float) – The regularization parameter “gamma/n”. (Default: gamma_n=0.1.)
- Returns:
w – The estimated weights by our debiasing program.
- Return type:
(n,)-array
- debiasing.debias_prog.DebiasProgCV(X, x, prop_score, gamma_lst=None, cv_fold=5, cv_rule='1se')[source]
Our proposed Debiasing (primal) program.
- Parameters:
X ((n,d)-array) – The input design matrix.
x ((d,)-array) – The current query point.
prop_score ((n,)-array) – The (estimated) propensity scores evaluted on the covariates.
gamma_lst (list or (m,)-array) – The list of candidate values for the tuning parameter “gamma/n”. (Default: gamma_lst=None. Then, gamma_lst contains 41 equally spacing value between 0.001 and max(abs(x)).)
cv_fold (int) – The number of folds for cross-validation on the dual program. (Default: cv_fold=5.)
cv_rule (string) – The criteria/rules for selecting the final value of the regularization parameter “gamma/n” in the dual program. (Default: cv_rule=’1se’. The candidate choices include ‘1se’, ‘minfeas’, and ‘mincv’.)
- Returns:
w_obs ((n,)-array) – The final estimated weights by our debiasing program.
ll_obs ((n,)-array) – The final value of the solution to our debiasing dual program.
gamma_n_opt (float) – The final value of the tuning parameter “gamma/n” selected by cross-validation.
- debiasing.debias_prog.DualADMM(X, x, Pi=None, gamma_n=0.05, rho=1, ll_init=None, eps=1e-09)[source]
Alternating direction method of multipliers (ADMM) algorithm for solving the dual form of our debiasing program.
- Parameters:
X ((n,d)-array) – The input design matrix.
x ((d,)-array) – The current query point.
Pi ((n,n)-array) – A diagonal matrix with (estimated) propensity scores as its diagonal entries.
gamma_n (float) – The regularization parameter “gamma/n”. (Default: gamma_n=0.05.)
rho (float) – The dual parameter in ADMM.
ll_init ((d,)-array) – The initial value of the dual solution vector. (Default: ll_init=None. Then, the vector with all-one entries is used.)
eps (float.) – The precision parameter for stopping the iteration. (Default: eps=1e-9.)
max_iter (int) – Maximum number of coordinate descent iterations. (Default: max_iter=5000.)
- Returns:
ll_new – The solution vector to our dual debiasing program.
- Return type:
(d,)-array
- debiasing.debias_prog.DualCD(X, x, Pi=None, gamma_n=0.05, ll_init=None, eps=1e-09, max_iter=5000)[source]
Coordinate descent algorithm for solving the dual form of our debiasing program.
- Parameters:
X ((n,d)-array) – The input design matrix.
x ((d,)-array) – The current query point.
Pi ((n,n)-array) – A diagonal matrix with (estimated) propensity scores as its diagonal entries.
gamma_n (float) – The regularization parameter “gamma/n”. (Default: gamma_n=0.05.)
ll_init ((d,)-array) – The initial value of the dual solution vector. (Default: ll_init=None. Then, the vector with all-one entries is used.)
eps (float.) – The precision parameter for stopping the iteration. (Default: eps=1e-9.)
max_iter (int) – Maximum number of coordinate descent iterations. (Default: max_iter=5000.)
- Returns:
ll_new – The solution vector to our dual debiasing program.
- Return type:
(d,)-array
- debiasing.debias_prog.DualObj(X, x, Pi, ll_cur, gamma_n=0.05)[source]
Compute the objective function of the dual form of our debiasing program.
- Parameters:
X ((n,d)-array) – The input design matrix.
x ((d,)-array) – The current query point.
Pi ((n,n)-array) – A diagonal matrix with (estimated) propensity scores as its diagonal entries.
ll_cur ((d,)-array) – The current value of the dual solution vector.
gamma_n (float) – The regularization parameter “gamma/n”. (Default: gamma_n=0.05.)
- Returns:
dual_obj – The value of the objective function of our dual debiasing program.
- Return type:
float
- debiasing.debias_prog.LassoRefit(X, Y, x, method='scaled_lasso', return_beta=False)[source]
Lasso refitting method.
- Parameters:
X ((n,d)-array) – The input design matrix.
Y ((n,)-array) – The input outcome (or response) vector.
x ((d,)-array) – The current query point.
method (string) – The actual method for fitting the Lasso regression. It can be either ‘sqrt_lasso’ or the default value ‘scaled_lasso’.
return_beta (logical) – Whether the final value of the estimated regression coefficient is returned or not. (Default: return_beta=False.)
- Returns:
m_refit (float) – The estimated regression function by Lasso refitting method.
beta_pilot ((d,)-array (optional)) – The estimated regression coefficient by scaled Lasso.
asym_sd (float) – The estimated (asymptotic) standard deviation of the Lasso refitting estimator.
sigma_hat (float) – The estimated noise level (i.e., the standard deviation of the noise variable).
df (int) – The degree of freedom of the t-distribution for the Lasso refitting estimator.
- debiasing.debias_prog.ScaledLasso(X, Y, lam0=None, return_lamb=False)[source]
Scaled sparse linear regression (Translated from R package ‘scalreg’).
- Parameters:
X ((n,d)-array) – The input design matrix.
Y ((n,)-array) – The input outcome (or response) vector.
lam0 (str or float) – The regularization parameter, which can be “univ”, “quantile” or other specified numerical value. (Default: lam0=None so that if d<10^6, lam0=”quantile”; otherwise, lam0=”univ”.)
return_lamb (logical) – Whether the final value of the regularization parameter is returned or not. (Default: return_lamb=False.)
- Returns:
beta_est ((d,)-array) – The estimated regression coefficient by scaled Lasso.
sigma_new (float) – The estimated noise level (i.e., the standard deviation of the noise variable).
lam (float (optional)) – The final value of the regularization parameter.