Skip to contents

\(S_{n,CB}(b) = (\pi_1/n_1)\sum_i Y_i 1\{X_i'b \ge 0\} - (\pi_0/n_0)\sum_i (1 - Y_i) 1\{X_i'b \ge 0\}\) (4.33), maximised subject to \(|b_1| = 1\); the smoothed form (4.35) replaces each indicator with \(K(X_i'b/h_n)\).

Usage

morie_choice_based_max_score(
  x,
  y,
  sampling_weights,
  smoothed = TRUE,
  h = NULL,
  n_restarts = 8L,
  seed = 0L
)

Arguments

x

numeric matrix of covariates, one row per observation.

y

binary 0/1 response.

sampling_weights

population share pi1, or c(pi0, pi1).

smoothed

use (4.35) rather than the discontinuous (4.33).

h

bandwidth for the smoothed form; n^(-1/5) when NULL.

n_restarts

restarts, since (4.33) is a step function.

seed

RNG seed for the restarts.

Value

list: beta, score, pi1, pi0, n1, n0, smoothed, bandwidth, rate_exponent, standard_errors_valid, n, d, method.

Details

A choice-based sample is stratified ON Y: the fraction with \(Y = 1\) is fixed by design and X is drawn conditional on Y. Estimators built for random samples are INCONSISTENT here except in special cases. The reweighting repairs that – the two terms are divided by the realised counts and multiplied by the POPULATION shares, assumed known from an external source such as a census. Passing sample shares instead silently reproduces the uncorrected estimator. Mirrors morie.fn.hrzcbsm.

References

Horowitz, Sec. 4.4.1, eqs. (4.33)-(4.35), Theorems 4.7-4.8.

Examples

set.seed(1)
x <- matrix(rnorm(400), ncol = 2)
y <- as.numeric(x %*% c(1, -0.8) + rnorm(200) > 0)
morie_choice_based_max_score(x, y, 0.5)$beta
#> [1]  1.00 -1.25