Skip to contents

Fits the same probit model as fast_probit_regression_cpp (see that page for the full model and optimizer contract; always with estimate_only = FALSE, and maxit/tol hardcoded to 100/\(10^{-8}\) — no override arguments here), and additionally inverts the fitted Fisher information matrix (compute_diagonal_inverse_entry on the free-coefficient submatrix) to report the variance of two coefficients.

Usage

fast_probit_regression_with_var_cpp(
  X,
  y,
  j = 2L,
  warm_start_beta = NULL,
  smart_cold_start = TRUE,
  fixed_idx = NULL,
  fixed_values = NULL,
  optimization_alg = "irls",
  warm_start_weights = NULL,
  warm_start_fisher_info = NULL
)

Arguments

X

A numeric matrix of predictors (including an intercept column, if desired).

y

A numeric vector of binary responses (0/1).

j

The 1-indexed coefficient whose variance to compute in ssq_b_j. Defaults to 2.

warm_start_beta

Optional starting values for coefficients \(\beta\). If provided, smart_cold_start is ignored.

smart_cold_start

Logical. If TRUE (the default) and no warm_start_beta is supplied, use an OLS-based initial guess; see fast_probit_regression_cpp Details.

fixed_idx

Optional indices of fixed parameters.

fixed_values

Optional values for fixed parameters.

optimization_alg

Optimization algorithm: any value other than "lbfgs" runs IRLS (default "irls"); "lbfgs" runs direct likelihood minimization; see fast_probit_regression_cpp Details.

warm_start_weights

Accepted but unused; see fast_probit_regression_cpp Details.

warm_start_fisher_info

Optional initial curvature matrix for the first IRLS iteration (IRLS path only).

Value

A list with components b, params (the fitted coefficients \(\hat\beta\), two aliases of the same vector), ssq_b_j (the variance of the \(j\)-th coefficient, NA if j indexes a fixed coefficient), ssq_b_2 (the variance of the second coefficient specifically, regardless of j; NA if the second column is fixed), score, observed_information / fisher_information / information (three aliases for the same \(X^\top W X\) curvature matrix; information_type is always "fisher"), hessian (the negative of that same matrix), neg_loglik/neg_ll (two aliases for the negative log-likelihood), loglik (-neg_ll, or NA if non-finite), converged, and iterations.

See also

fast_probit_regression_cpp for the estimate-only-capable variant and full model documentation.