Skip to contents

Fits the same log-link (relative-risk) binomial regression as fast_log_binomial_regression_cpp (see that page for the full model) and additionally computes the variance of a single caller-selected coefficient — the log-link analog of fast_identity_binomial_regression_with_var_cpp, sharing exactly the same targeted-diagonal-entry variance mechanism and the same caveat: this entry point does not compute or return a full variance-covariance matrix or per-coefficient standard errors, despite its name; only the coefficient named by j gets a variance (ssq_b_j), and the returned vcov/std_err/z_vals fields are always empty placeholders (see fast_identity_binomial_regression_with_var_cpp's Details for the exact mechanics, identical here up to the link function).

Usage

fast_log_binomial_regression_with_var_cpp(
  X,
  y_r,
  j = 2L,
  maxit = 100L,
  tol = 1e-06,
  fixed_idx = NULL,
  fixed_values = NULL,
  warm_start_beta = NULL,
  smart_cold_start = TRUE,
  warm_start_weights = NULL,
  warm_start_fisher_info = NULL
)

Arguments

X

A numeric matrix of predictors, \(n \times p\).

y_r

A binary (0/1) numeric vector of responses, length \(n\).

j

1-based index (into X's columns) of the coefficient to compute ssq_b_j for.

maxit

Maximum number of Fisher-scoring iterations.

tol

Convergence tolerance.

fixed_idx

Optional integer indices of coefficients to hold fixed rather than estimate.

fixed_values

Optional values to fix the parameters named by fixed_idx at.

warm_start_beta

Optional starting values for coefficients. If provided, smart_cold_start is ignored.

warm_start_weights

Optional initial working weights for the first IRLS iteration.

warm_start_fisher_info

Optional initial Fisher Information matrix for the first IRLS iteration.

Value

A list with components b, ssq_b_j, converged, fisher_information, neg_ll/logLik (present only on the success path), and the always-empty vcov/std_err/ z_vals placeholders; see fast_identity_binomial_regression_with_var_cpp for the exact field semantics (shared verbatim here).

See also

fast_log_binomial_regression_cpp for the estimate-only variant; fast_identity_binomial_regression_with_var_cpp for the identity-link analog with the same targeted-variance mechanism.