hatMatrix: Function determines the Hat matrix or projection matrix for...

Description Usage Arguments Value Examples

View source: R/hatMatrix.R

Description

Function hatMatrix determines the projection matrix for X from the form yhat=Hy. The projection matrix defines the influce of each variable on fitted value The diagonal elements of the projection matrix are the leverages or influence each sample has on the fitted value for that same observation. The projection matrix is evaluated with I.I.D assumtion ~N(0, 1)

Usage

1
hatMatrix(X, covmat = NULL)

Arguments

X

: Input Matrix

covmat

: covariance matrix for error, if the error are correlated for I.I.D covmat will be NULL matrix

Value

X: Projection Matrix

Examples

1
2
3
4
5
X<-matrix(c(6,-4,1, -4,6,-4,1,-4,6), nrow=3,ncol=3, byrow = TRUE)
covmat <- matrix(rnorm(3 * 3), 3, 3)
H<-hatMatrix(X)
H<-hatMatrix(X, covmat)
diag(H)

optR documentation built on May 29, 2017, 2:10 p.m.

Related to hatMatrix in optR...