eb2: Function for Generating Minimum Entropy Weights Subject to a...

View source: R/eb2.R

eb2R Documentation

Function for Generating Minimum Entropy Weights Subject to a Set of Balancing Constraints

Description

eb2 is an adaptation of eb that generates minimum entropy weights subject to a set of balancing constraints. Using the method of Lagrange multipliers, the dual problem is an unconstrained optimization problem that can be solved using Newton's method. When a full Newton step is excessive, an exact line search is used to find the best step size.

Usage

eb2(C, M, Q, Z = rep(0, ncol(C)), max_iter = 200, tol = 1e-04, print_level = 1)

Arguments

C

A constraint matrix where each column corresponds to a balancing constraint.

M

A vector of moment conditions to be met in the reweighted sample. Specifically, in the reweighted sample, we should have C'W=M, where W is a column vector representing the new weights. When called internally, it is a vector of zeros with length equal to the number of columns in C.

Q

A vector of base weights.

Z

A vector of Lagrange multipliers to be initialized.

max_iter

Maximum number of iterations for Newton's method in entropy minimization.

tol

Tolerance parameter used to determine convergence. Specifically, convergence is achieved if tol is greater than the maximum absolute value of the deviations between the moments of the reweighted data and the target moments (i.e., M).

print_level

The level of printing:

1

normal: print whether the algorithm converges or not.

2

detailed: print also the maximum absolute value of the deviations between the moments of the reweighted data and the target moments in each iteration.

3

very detailed: print also the step length of the line searcher in iterations where a full Newton step is excessive.

Value

A list containing the results from the algorithm.

W

A vector of normalized minimum entropy weights.

Z

A vector of Lagrange multipliers.

converged

A logical indicator for convergence.

maxdiff

A scalar indicating the maximum deviation between the moments of the reweighted data and the target moments.


rbw documentation built on March 18, 2022, 5:35 p.m.