Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

detrend

Projection of a model matrix on the orthogonal complement of a trend or curvature.


Description

The columns of a model matrix M is projected on the orthogonal complement to the matrix (1,t), resp. (1,t,t^2).

Orthogonality is w.r.t. an inner product defined by the positive definite matrix matrix diag(weight). Non-diagonal matrices defining the inner product is not supported.

Usage

detrend( M, t, weight = rep(1, nrow(M)) )
  decurve( M, t, weight = rep(1, nrow(M)) )

Arguments

M

A model matrix.

t

The trend defining a subspace. A numerical vector of length nrow(M).

weight

Weights defining the inner product of vectors x and y as sum(x*w*y). A numerical vector of length nrow(M), defaults to a vector of 1s. Must be all non-negative.

Details

The functions are intended to be used in construction of particular parametrizations of age-period-cohort models.

Value

detrend returns full-rank matrix with columns orthogonal to (1,t); decurve returns full-rank matrix with columns orthogonal to (1,t,t^2).

Author(s)

Bendix Carstensen, Steno Diabetes Center Copenhagen, http://bendixcarstensen.com, with essential help from Peter Dalgaard.

See Also


Epi

Statistical Analysis in Epidemiology

v2.44
GPL-2
Authors
Bendix Carstensen [aut, cre], Martyn Plummer [aut], Esa Laara [ctb], Michael Hills [ctb]
Initial release
2021-02-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.