correctSign: Corrects negative values in the health variable

Description Usage Arguments Value Author(s) See Also Examples

Description

The Relative Concentration Index is not bonded between [-1,1] if the health variable contains both negative and positive values. This function corrects for this either by imputing a value of 0 for all negative values or by subtracting the minimum value.

Usage

1
correctSign(x, shift = TRUE)

Arguments

x

a numeric vector, typically representing health.

shift

logical. If FALSE (the default), 0 is imputed for all negative values in x. If TRUE the minimum value of x is subtracted from it.

Value

Returns a a list with 2 components:

corrected

corrected version of x

modified

logical, TRUE when any of the elements of x have been changed

These components can be extracted with the functions correctedValue and isCorrected.

Author(s)

Peter Konings

See Also

RCI

Examples

1
2
3
4
5
6
7
data(kenya)
kenya$stunting.shifted <- correctedValue(correctSign(kenya$stunting, shift = TRUE))
kenya$stunting.imputed <- correctedValue(correctSign(kenya$stunting, shift = FALSE))
# show the effect of both methods
plot(density(kenya$stunting, na.rm = TRUE))
points(density(kenya$stunting.shifted, na.rm = TRUE), col = 'blue')
points(density(kenya$stunting.imputed, na.rm = TRUE), col = 'green')

decomp documentation built on May 2, 2019, 6:53 p.m.