*! version 1.0 Fernando Rios-Avila July 2019
help hvar()

Title

hvar() -- Extension to generates recentered influence
function for half-variance

Syntax

egen [type] newvar =
hvar(varname)
[if] [in]
[, by(varname) weight(varname) [hvp|hvn]]

by(varname) indicate the variables over which the recentered
influence function (RIF) will be
estimated

weight(varname) indicate the weight to be used for the
estimation of RIFs

hvp estimate the positive half-variance (default)

hvn estimate the negative half-variance

Description

egen hvar() creates a new variable, newvar, of the optionally
specified storage type equal to the RIF for the half-variance using the
jackknife method, over a set of groups specified with by() and
considering weights specified with weight().

Remarks

This program is meant to be a template to write programs that can be used to
create RIF functions for statistics not available in rifvar()
so that rifvar(), oaxaca_rif, and rifhdreg can
be used with other RIFs.

The program estimates the half-variance, which is defined as follows:

HVAR_positive = sum[*^2]

HVAR_negative = sum[*^2]

HVAR_positive can be requested with the option hvp, and HVAR_negative
can be requested with the option hvn.

Author

Fernando Rios-Avila

Levy Economics Institute of Bard College

Annandale-on-Hudson, NY

friosavi@levy.org

Also see

Help: rifvar() rifhdreg, rifreg,
rifsureg, rifsureg2, uqreg, (if installed),
[D] egen