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: glm
See also: glmest glmstat eigsm

Quantlet: glmdiagh
Description: glmdiagh calculates the diagonal elements of the 'hat' matrix

Link:
Usage: h = glmdiagh(bv,x{,w})
Input:
bv p x p matrix, the estimated covariance matrix for the coefficients.
x n x p matrix, the matrix of (observed) regressor variables.
w optional, n x 1 matrix, the weights used to estimate the coefficients.
Output:
h n x 1 matrix, the diagonal elements of the `hat' matrix: W'^(1/2)X(X'WX)^(-1) X'W^(1/2).

Example:
library("glm")
n = 100
b = 2|(-1)
x = normal(n,rows(b))
m = ceil(uniform(n).*5)
{y,p} = genglm("bilo",x,b,m)
opt=glmopt("wx",m)
l = glmest("bilo",x,y,opt)
d=glmlld("bilo",x*b,y,opt)
h=glmdiagh(l.bv,x, -m.*d.ll2)

Result:
Vector of diagonal elements of the hat matrix.



Author: M. Mueller, 20010228
(C) MD*TECH Method and Data Technologies, 05.02.2006