Pm {DCCA}R Documentation

Projection Matrix P

Description

Creates the m+1 by m+1 projection matrix defined by P = D(D'D)^{-1}D' where D is the design matrix associated to a polynomial regression of degree nu + 1.

Usage

Pm(m = 2, nu = 0)

Arguments

nu

the degree of the polinomial fit.

m

a positive integer satisfying m >= nu indicating the size of the window for the polinomial fit.

Details

To perform matrix inversion, the code makes use of the routine DGETRI in LAPACK, which applies an LU decomposition approach to obtain the inverse matrix. See the LAPACK documentation available at http://www.netlib.org/lapack.

Value

an m+1 by m+1 matrix.

Author(s)

Taiane Schaedler Prass

Examples

P = Pm(m = 5, nu = 0)
P

n = 10
t = 1:n
D = cbind(rep(1,n),t,t^2)

# Calculating in R
PR = D%*%solve(t(D)%*%D)%*%t(D)
# Using the provided function
P = Pm(m = n-1, nu = 1)

# Difference:
sum(abs(P-PR))


[Package DCCA version 0.1.1 Index]