Skip to contents

Within each id, carries forward the most recent non-missing value of x, treating small relative changes (within threshold) as unchanged, assuming observations are already ordered within each id.

Usage

OR.dose.weights(x, id = NULL, threshold = 0)

Arguments

x

Numeric vector of sorted weights.

id

Optional vector of cluster identifiers. If NULL, all observations are treated as a single cluster.

threshold

Relative change threshold for updating the current value. Default = 0.

Value

Numeric vector of same length as x with stabilized and imputed weights.

Details

Zeros in x are treated as missing. If the first value within a cluster is missing, it is initialized to the first non-missing value in that cluster.

For example, with threshold = 0.1, changes within ±10% are ignored: c(0, 100, NA, 105, 110) is replaced with c(100, 100, 100, 100, 110).

See also

Other dose: OR.dose.vials()