Package 'monotone'

Title: Performs Monotone Regression
Description: The monotone package contains a fast up-and-down-blocks implementation for the pool-adjacent-violators algorithm for simple linear ordered monotone regression, including two spin-off functions for unimodal and bivariate monotone regression (see <doi:10.18637/jss.v102.c01>).
Authors: Frank Busing [aut, cre], Juan Claramunt Gonzalez [aut]
Maintainer: Frank Busing <[email protected]>
License: GPL-3
Version: 0.1.2
Built: 2024-10-15 06:15:45 UTC
Source: https://github.com/cran/monotone

Help Index


Bivariate Monotone Regression Function

Description

bimonotone performs bivariate monotone regression. The function uses the up-and-down-blocks implementation (Kruskal, 1964) of the pool-adjacent-violators algorithm (Ayer, Brunk, Ewing, Reid, and Silverman, 1955), with additional lookaheads, repeatedly, for both rows and columns, until convergence.

Usage

bimonotone(
  x,
  w = matrix(1, nrow(x), ncol(x)),
  maxiter = 65536,
  eps = 1.49011611938477e-08
)

Arguments

x

a real-valued matrix.

w

a real-valued matrix with positive weights (default a matrix with ones).

maxiter

maximum number of iterations (default = 65536)

eps

precision of estimates (default = 1.4901161193847656e-08)

Details

Error checking on x, w, maxiter, or eps is not present.

Value

Returns a real-valued matrix with values of both rows and columns of x in monotone order.

References

Bril G, Dykstra R, Pillers C, Robertson T (1984). Algorithm AS 206: isotonic regression in two independent variables. Journal of the Royal Statistical Society. Series C (Applied Statistics), 33(3), 352-357. URL https://www.jstor.org/stable/pdf/2347723.pdf.

Busing, F.M.T.A. (2022). Monotone Regression: A Simple and Fast O(n) PAVA Implementation. Journal of Statistical Software, Code Snippets, 102 (1), pp. 1-25. (<doi:10.18637/jss.v102.c01>)

Dykstra R.L., Robertson T. (1982). An algorithm for isotonic regression for two or more independent variables. The Annals of Statistics, 10(3), 708-716. URL https: //projecteuclid.org/download/pdf_1/euclid.aos/1176345866.

Turner, T.R. (2019). Iso: Functions to Perform Isotonic Regression. R package version 0.0-18. URL https://cran.r-project.org/package=Iso

Examples

G <- matrix( c( 1, 5.2, 0.1, 0.1, 5, 0, 6, 2, 3, 5.2, 5, 7, 4, 5.5, 6, 6 ), 4, 4 )
print( G )
H <- bimonotone( G )
print( H )
y <- c( 8, 4, 8, 2, 2, 0, 8 )
x <- bimonotone( as.matrix( y ) )
print( x )
x <- bimonotone( t( as.matrix( y ) ) )
print( x )

Monotone Regression Legacy Function

Description

legacy provides some functions for monotone regression from the past. Current implementations have been translated into C for proper comparison in Busing (2022).

Usage

legacy(x, w = rep(1, length(x)), number = 0)

Arguments

x

a real-valued vector.

w

a real-valued vector with positive weights (default a vector with ones).

number

function number (specifications below).

Details

Legacy implementations by number, function, author, and year:

  • 0 = default (do nothing)

  • 1 = fitm() by Kruskal (1964).

  • 2 = wmrmnh() by van Waning (1976).

  • 3 = amalgm() by Cran (1980).

  • 4 = pav() by Bril (1984).

  • 5 = isoreg() by Gupta (1995).

  • 6 = iso_pava() by Turner (1997).

  • 7 = isotonic() by Kincaid (2001).

  • 8 = isomean() by Strimmer (2008).

  • 9 = pooled_pava() by Pedregosa (2011).

  • 10 = linear_pava() by Tulloch (2014).

  • 11 = inplace_pava() by Varoquaux (2016).

  • 12 = md_pava() by Danish (2016).

  • 13 = reg_1d_l2() by Xu (2017).

  • 14 = jbkpava() by de Leeuw (2017).

Error checking on w or x is not present.

Value

Returns a real-valued vector with values of x in increasing order.

References

Busing, F.M.T.A. (2022). Monotone Regression: A Simple and Fast O(n) PAVA Implementation. Journal of Statistical Software, Code Snippets, 102 (1), pp. 1-25. (<doi:10.18637/jss.v102.c01>)

Examples

y <- c( 8, 4, 8, 2, 2, 0, 8 )
x <- legacy( y, number = 1 )
print( x )

Monotone Regression Function

Description

monotone performs simple linear ordered monotone or isotonic regression. The function follows the up-and-down-blocks implementation (Kruskal, 1964) of the pool-adjacent-violators algorithm (Ayer, Brunk, Ewing, Reid, and Silverman, 1955) with additional lookaheads (Busing, 2022).

Usage

monotone(x, w = rep(1, length(x)))

Arguments

x

a real-valued vector.

w

a real-valued vector with positive weights (default a vector with ones).

Details

Error checking on x or w is not present.

Value

Returns a real-valued vector with values of x in increasing order.

References

Ayer M., H.D. Brunk, G.M. Ewing, W.T. Reid, and E. Silverman (1955). An empirical distribution function for sampling with incomplete information. The Annals of Mathematical Statistics, pp. 641-647. URL https://www.jstor.org/stable/pdf/2236377.pdf.

Busing, F.M.T.A. (2022). Monotone Regression: A Simple and Fast O(n) PAVA Implementation. Journal of Statistical Software, Code Snippets, 102 (1), pp. 1-25. (<doi:10.18637/jss.v102.c01>)

Kruskal, J.B. (1964). Nonmetric multidimensional scaling: a numerical method. Psychometrika, 29(2), pp. 115-129. URL http://cda.psych.uiuc.edu/psychometrika_highly_cited_articles/kruskal_1964b.pdf.

Examples

y <- c( 8, 4, 8, 2, 2, 0, 8 )
x <- monotone( y )
print( x )

Unimodal Monotone Regression Function

Description

unimonotone performs unimodal monotone regression. The function follows the up-and-down-blocks implementation (Kruskal, 1964) of the pool-adjacent-violators algorithm (Ayer, Brunk, Ewing, Reid, and Silverman, 1955) for both isotonic and antitonic regression, and the prefix isotonic regression approach (Stout, 2008) with additional lookaheads and progressive error sum-of-squares computation.

Usage

unimonotone(x, w = rep(1, length(x)))

Arguments

x

a real-valued vector.

w

a real-valued vector with positive weights (default a vector with ones).

Details

Error checking on x or w is not present.

Value

Returns a real-valued vector with values of x in umbrella order.

References

Bril G, Dykstra R, Pillers C, Robertson T (1984). Algorithm AS 206: isotonic regression in two independent variables. Journal of the Royal Statistical Society. Series C (Applied Statistics), 33(3), 352-357. URL https://www.jstor.org/stable/pdf/2347723.pdf.

Busing, F.M.T.A. (2022). Monotone Regression: A Simple and Fast O(n) PAVA Implementation. Journal of Statistical Software, Code Snippets, 102 (1), pp. 1-25. (<doi:10.18637/jss.v102.c01>)

Stout, Q.F. (2008). Unimodal Regression via Prefix Isotonic Regression. Computational Statistics and Data Analysis, 53, pp. 289-297. URL https://doi:10.1016/j.csda.2008.08.005

Turner, T.R. and Wollan, P.C. (1997). Locating a maximum using isotonic regression. Computational statistics and data analysis, 25(3), pp. 305-320. URL https://doi.org/10.1016/S0167-9473(97)00009-1

Turner, T.R. (2019). Iso: Functions to Perform Isotonic Regression. R package version 0.0-18. URL https://cran.r-project.org/package=Iso

Examples

y <- c( 0.0,61.9,183.3,173.7,250.6,238.1,292.6,293.8,268.0,285.9,258.8,
297.4,217.3,226.4,170.1,74.2,59.8,4.1,6.1 )
x <- unimonotone( y )
print( x )