Skip to contents

As fast_stereotype_logit_cpp (see that page for the full stereotype logit model), but always computes the observed information and the variance of \(\hat\beta_1\) (the first, and typically only meaningfully identified, regression coefficient — conventionally the treatment effect). The primary variance estimate is \([(-H)^{-1}]_{\beta_1\beta_1}\) from the observed information (negative Hessian) at the fitted parameters. If \(\beta_1\) is not held fixed (via fixed_idx) and that entry comes out non-finite (e.g. the information matrix is singular), this function falls back to a profile-likelihood variance: it re-optimizes all nuisance parameters (everything except \(\beta_1\)) at \(\hat\beta_1\), \(\hat\beta_1 \pm h\) (\(h = \max(10^{-4}, 10^{-3}(|\hat\beta_1| + 1))\)), takes the central second-difference of the resulting profile log-likelihood to approximate the profile information \(I(\hat\beta_1)\), and reports \(1/I(\hat\beta_1)\) if that comes out finite and positive (otherwise the variance remains NA). vcov is never populated (always NULL/missing) — only the single \(\beta_1\) variance is available from this function.

Usage

fast_stereotype_logit_with_var_cpp(
  X,
  y,
  maxit = 100L,
  tol = 1e-08,
  smart_cold_start = TRUE,
  fixed_idx = NULL,
  fixed_values = NULL,
  optimization_alg = "newton_raphson",
  warm_start_fisher_info = NULL,
  warm_start_params = NULL,
  warm_start_beta = NULL,
  estimate_only = FALSE
)

Arguments

X

A numeric matrix of predictors (no intercept column needed; see fast_stereotype_logit_cpp).

y

A numeric vector of categorical (nominal or ordinal) responses; only the set of distinct values matters, not their numeric coding or order.

maxit

Maximum number of optimizer iterations.

tol

Convergence tolerance.

smart_cold_start

Present for interface parity but currently has no effect; see fast_stereotype_logit_cpp Details.

fixed_idx

Optional 1-indexed positions (into the joint parameter vector, alpha first) of parameters to hold fixed.

fixed_values

Optional values, parallel to fixed_idx, of the fixed parameters.

optimization_alg

Optimization algorithm (default "newton_raphson").

warm_start_fisher_info

Optional initial curvature matrix for the first optimizer iteration.

warm_start_params

Optional starting values for the full joint parameter vector. Takes precedence over warm_start_beta.

warm_start_beta

Optional starting values for \(\beta\) alone (ignored if warm_start_params is supplied).

estimate_only

Accepted for interface parity but ignored: this function always computes the observed information and ssq_b_1/ssq_b_j regardless of its value.

Value

A list with components b (\(\hat\beta\)), alpha (the \(K-1\) free intercepts), params (the full fitted joint parameter vector), ssq_b_1 and ssq_b_j (identical aliases for the variance of \(\hat\beta_1\), computed as described above; NA if unavailable), vcov (always missing/NULL), converged, and fisher_information (the observed information, i.e. negative Hessian, at the fitted parameters).

See also

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