glm¶
Module: glm
¶
Functions¶
-
selectinf.glm.
bootstrap_cov
(sampler, boot_target, cross_terms=(), nsample=2000)[source]¶ m out of n bootstrap
returns estimates of covariance matrices: boot_target with itself, and the blocks of (boot_target, boot_other) for other in cross_terms
-
selectinf.glm.
glm_parametric_covariance
(glm_loss, solve_args={'min_its': 50, 'tol': 1e-10})[source]¶ A constructor for parametric covariance
-
selectinf.glm.
pairs_bootstrap_glm
(glm_loss, active, beta_full=None, inactive=None, scaling=1.0, solve_args={'min_its': 50, 'tol': 1e-10})[source]¶ Construct a non-parametric bootstrap sampler that samples the estimates (\(ar{eta}_E^*\)) of a generalized linear model (GLM) restricted to active as well as, optionally, the inactive coordinates of the score of the GLM evaluated at the estimates (:math:`
- abla ell(ar{eta}_E)[-E]`) where
\(ar{eta}_E\) is padded with zeros where necessary.
- Parameters
glm_loss : regreg.smooth.glm.glm
The loss of the generalized linear model.
- activenp.bool
Boolean indexing array
- beta_fullnp.float (optional)
Solution to the restricted problem, zero except where active is nonzero.
- inactivenp.bool (optional)
Boolean indexing array
- scalingfloat
Scaling to keep entries of roughly constant order. Active entries are multiplied by sqrt(scaling) inactive ones are divided by sqrt(scaling).
- solve_argsdict
Arguments passed to solver of restricted problem (restricted_estimator) if beta_full is None.
- Returns
bootstrap_sampler : callable
A callable object that takes a sample of indices and returns the corresponding bootstrap sample.
-
selectinf.glm.
pairs_bootstrap_score
(glm_loss, active, beta_active=None, solve_args={'min_its': 50, 'tol': 1e-10})[source]¶ Construct a non-parametric bootstrap sampler that samples the score (:math:`
- abla ell(ar{eta}_E)) ofa generalized
linear model (GLM) restricted to active as well as, optionally, the inactive coordinates of the score of the GLM evaluated at the estimates (`
- abla ell(ar{eta}_E)[-E]:math:`) where
`ar{eta}_E$ is padded with zeros where necessary.
- Parameters
glm_loss : regreg.smooth.glm.glm
The loss of the generalized linear model.
- activenp.bool
Boolean indexing array
- beta_activenp.float (optional)
Solution to the restricted problem.
- solve_argsdict
Arguments passed to solver of restricted problem (restricted_estimator) if beta_full is None.
- Returns
bootstrap_sampler : callable
A callable object that takes a sample of indices and returns the corresponding bootstrap sample.
-
selectinf.glm.
pairs_inactive_score_glm
(glm_loss, active, beta_active, scaling=1.0, inactive=None, solve_args={'min_its': 50, 'tol': 1e-10})[source]¶ Construct a non-parametric bootstrap sampler that samples the inactive coordinates of the score of the GLM evaluated at the estimates (:math:`
- abla ell(ar{eta}_E)[-E]`) where
\(ar{eta}_E\) is padded with zeros where necessary.
- Parameters
glm_loss : regreg.smooth.glm.glm
The loss of the generalized linear model.
- activenp.bool
Boolean indexing array
- beta_activenp.float (optional)
Solution to the restricted problem.
- scalingfloat
Scaling to keep entries of roughly constant order. Active entries are multiplied by sqrt(scaling) inactive ones are divided by sqrt(scaling).
- inactivenp.bool (optional)
Which coordinates to return. If None, defaults to ~active.
- solve_argsdict
Arguments passed to solver of restricted problem (restricted_estimator) if beta_full is None.
- Returns
bootstrap_sampler : callable
A callable object that takes a sample of indices and returns the corresponding bootstrap sample.
-
selectinf.glm.
parametric_cov
(glm_loss, target_with_linear_func, cross_terms=(), dispersion=None, solve_args={'min_its': 50, 'tol': 1e-10})[source]¶
-
selectinf.glm.
set_alpha_matrix
(glm_loss, active, beta_full=None, inactive=None, scaling=1.0, solve_args={'min_its': 50, 'tol': 1e-10})[source]¶ DESCRIBE WHAT THIS DOES
- Parameters
glm_loss : regreg.smooth.glm.glm
The loss of the generalized linear model.
active : np.bool
Boolean indexing array
beta_full : np.float (optional)
Solution to the restricted problem, zero except where active is nonzero.
inactive : np.bool (optional)
Boolean indexing array
scaling : float
Scaling to keep entries of roughly constant order. Active entries are multiplied by sqrt(scaling) inactive ones are divided by sqrt(scaling).
solve_args : dict
Arguments passed to solver of restricted problem (restricted_estimator) if beta_full is None.
- Returns