Description Usage Arguments Value Author(s) See Also Examples
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.
1 | correctSign(x, shift = TRUE)
|
x |
a numeric vector, typically representing health. |
shift |
logical. If |
Returns a a list with 2 components:
corrected |
corrected version of |
modified |
logical, |
These components can be extracted with the functions correctedValue
and isCorrected
.
Peter Konings
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')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.