standardize: Re-weight groups to target population means

View source: R/standardize.R

standardizeR Documentation

Re-weight groups to target population means

Description

Re-weight groups to target population means

Usage

standardize(
  X,
  target,
  Z,
  lambda = 0,
  lowlim = 0,
  uplim = 1,
  scale_sample_size = T,
  data_in = NULL,
  verbose = TRUE,
  return_data = TRUE,
  exact_global = T,
  init_uniform = F,
  eps_abs = 1e-05,
  eps_rel = 1e-05,
  ...
)

Arguments

X

n x d matrix of covariates

target

Vector of population means to re-weight to

Z

Vector of group indicators with J levels

lambda

Regularization hyper parameter, default 0

lowlim

Lower limit on weights, default 0

uplim

Upper limit on weights, default 1

scale_sample_size

Whether to scale the dispersion penalty by the sample size of each group, default T

data_in

Optional list containing pre-computed objective matrix/vector and constraints (without regularization term)

verbose

Whether to show messages, default T

return_data

Whether to return the objective matrix and vector and constraints, default T

exact_global

Whether to enforce exact balance for overall population

init_uniform

Wheter to initialize solver with uniform weights

eps_abs

Absolute error tolerance for solver

eps_rel

Relative error tolerance for solver

...

Extra arguments for osqp solver

Value

  • weights Estimated primal weights as an n x J matrix

  • imbalance Imbalance in covariates as a d X J matrix

  • data_out List containing elements of QP min 0.5 x'Px + q'x st l <= Ax <= u

    • P, q

    • constraints A, l , u


ebenmichael/balancer documentation built on Jan. 17, 2024, 2:56 p.m.