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 boundary-constrained IRLS line search), with each observation's contribution to the log-likelihood and IRLS working weights multiplied by a nonnegative row weight weights_r[i]. Setting all weights to 1 recovers fast_log_binomial_regression_cpp exactly.

Usage

fast_log_binomial_regression_weighted_cpp(
  X,
  y_r,
  weights_r,
  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,
  estimate_only = FALSE
)

Arguments

X

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

y_r

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

weights_r

A nonnegative numeric vector of length \(n\) giving each row's weight.

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 the same components as fast_log_binomial_regression_cpp: b, mu_hat, working_weights, iterations, converged, and fisher_information (all reflecting the weighted log-likelihood).

See also

fast_log_binomial_regression_cpp for the unweighted model and full documentation.