balancing.weights: Compute balancing weights using FLEXOR or other methods

View source: R/stage-1.R

balancing.weightsR Documentation

Compute balancing weights using FLEXOR or other methods

Description

This function calculates balancing weights based on the specified pseudo-population method.

Usage

balancing.weights(
  S,
  Z,
  X,
  method,
  naturalGroupProp,
  num.random = 40,
  gammaMin = 0.001,
  gammaMax = (1 - 0.001),
  seed = NULL,
  verbose = TRUE
)

Arguments

S

Vector of factor levels representing the study memberships. Takes values in {1, ..., J}.

Z

Vector of factor levels representing the group memberships. Takes values in {1, ..., K}.

X

Covariate matrix of N rows and p columns.

method

Pseudo-population method, i.e., weighting method. Take values in FLEXOR, IC, or IGO.

naturalGroupProp

Relevant only for FLEXOR method: a fixed user-specified probability vector \theta.

num.random

Relevant only for FLEXOR method: number of random starting points of \gamma in the two-step iterative procedure. Default is 40.

gammaMin

Relevant only for FLEXOR method: Lower bound for each \gamma_s in the two-step iterative procedure. Default is 0.001.

gammaMax

Relevant only for FLEXOR method: Upper bound for each \gamma_s in the two-step iterative procedure. Default is 0.999.

seed

Seed for random number generation. Default is NULL.

verbose

Logical; Relevant only for FLEXOR method: if TRUE (default), displays progress messages during computation to the console. Set to FALSE to suppress these messages.

Value

An S3 list object with the following components:

wt.v

N empirically normalized sample weights.

percentESS

Percentage sample effective sample size (ESS) for the pseudo-population.

Examples

data(demo)
balancing.weights(S, Z, X, method = "IC", naturalGroupProp)


WMAP documentation built on April 3, 2025, 8:55 p.m.

Related to balancing.weights in WMAP...