Pm: Projection Matrix P

Description Usage Arguments Details Value Author(s) Examples

View source: R/code.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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))

DCCA documentation built on Jan. 1, 2020, 5:06 p.m.

Related to Pm in DCCA...