https://github.com/cran/Epi
Raw File
Tip revision: d8292e6e657cff5d9aed0ba360a51b75f414c7d7 authored by Bendix Carstensen on 27 March 2009, 00:00:00 UTC
version 1.0.12
Tip revision: d8292e6
detrend.R
detrend <-
function( M, t, weight=rep(1,nrow(M)) )
{
Thin.col <-
function ( X, tol = 1e-06)
# Function to remove lin. dep. columns from a matrix
# (stolen from PD, existed at some time as stats:::Thin.col )
{
  QR <- qr(X, tol = tol, LAPACK = FALSE)
  X[, QR$pivot[seq(length = QR$rank)], drop = FALSE]
}
# Now detrend the matrix using the weighted inner product.
  Thin.col( projection.ip( cbind( 1, t ), M , orth = TRUE, weight = weight ) )
}
back to top