Learn R Programming

inca (version 0.0.4)

adjWeights: Function for Weights Adjustments

Description

This function provides a trimming procedure to force the weights to be within the provided boundaries

Usage

adjWeights(weights, lower = -Inf, upper = +Inf)

Arguments

weights

A numerical vector of weights

lower

A numerical vector of lower bounds

upper

A numerical vector of upper bounds

Value

A vector of adjusted weights

Details

The function produces trimmed weights, which will be the input for the rounding technique before integer calibration. When the weights are bounded, the function rounds-up the lower bounds and rounds-down the upper. If the condition upper > lower + 1, an error is returned.

Examples

Run this code
# NOT RUN {
library(inca)
w <- rnorm(150, 0, 2)
aw <- adjWeights(w, runif(150, -3, -1), runif(150, 1, 3))
hist(aw, main = "Adjusted weights")

# }

Run the code above in your browser using DataLab