Learn R Programming

SAGx (version 1.46.0)

pava: Pooling of Adjacent Violators

Description

The PAVA algorithm

Usage

pava(x, wt = rep(1, length(x)))

Arguments

x
A numeric sequence
wt
observation weights; 1 by default.

Value

  • A non-decreasing sequence

Details

The algorithm will turn a non-increasing into a non-decreasing one. pava is an internal function used to force monotonicity, e.g. of p1 in function Zfreq

Examples

Run this code
pava(c(1,2,4,3,5))
# [1] 1.0 2.0 3.5 3.5 5.0

Run the code above in your browser using DataLab