Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: xplore
See also: xdiag diag diagrv

Quantlet: xdiagp
Description: calculates the diagonal elements of a projection matrix X(X'X)^(-1) X' or (diag(w)^(1/2))X(X'diag(w)X)^(-1) X'diag(w)^(1/2); the calculation may be performed with a weight vector W.

Usage: d = xdiagp (x {,w})
Input:
x n x p matrix
w optional, n x 1 weight vector
Output:
d n x 1 vector of diagonal elements of the projection matrix X(X'X)^(-1) X' or (diag(w)^(1/2))X(X'diag(w)X)^(-1) X'diag(w)^(1/2)

Example:
library("xplore")
n=10
x=(1:n)~matrix(n)
xdiagp(x)

Result:
Contents of d
[ 1,]  0.34545
[ 2,]  0.24848
[ 3,]  0.17576
[ 4,]  0.12727
[ 5,]  0.10303
[ 6,]  0.10303
[ 7,]  0.12727
[ 8,]  0.17576
[ 9,]  0.24848
[10,]  0.34545
Example:
library("xplore")
n=5
x=(1:n)~matrix(n)
w = sqrt((1:n))
xdiagp(x, w)

Result:
Contents of d
[1,]      0.6
[2,]  0.42426
[3,]  0.34641
[4,]      0.6
[5,]   1.3416



Author: W. Haerdle, T. Koetter, Marlene Mueller, 20021120
(C) MD*TECH Method and Data Technologies, 05.02.2006