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: metrics
See also: hhmult glmest sker

Quantlet: hhtest
Description: hhtest calculates the H-H statistic to test the specification of the link function of a generalized linear model (such as the logit or probit model), assuming the index is correctly specified.

Reference(s):

Usage: {t,p} = hhtest(vhat,y,yhat,h,{c,{m}})
Input:
vhat n x 1 matrix with the projected index
y n x 1 matrix
yhat n x 1 matrix with the parametric estimate of E(Y|X)
h scalar (positive) -- the bandwidth for kernel regression with Quartic kernel
c scalar 0 =< c < 1 (optional) -- proportion of the sample to be cut in each extreme. Default is 0.05.
m n x 1 or the scalar 1. m should be given only for binary responses. If the data is binomial m is the vector with the binomial coeficients. If the data is bernouli, m=1. m is necessary to calculate the vari- ance of y. If y is not binary the variance will be given by a nonparametric regression of (y-fhat)^2 on vhat.
Output:
t scalar -- the statistic value
p scalar -- the p-value of t

Example:
library("metrics")
x = read("kyphosis.dat")
y = x[,4]
x = x[,1:3]
x = matrix(rows(x))~x
h = 2
myfit=glmest("bilo",x,y)
eta=x*myfit.b
mu=1./(1+exp(-eta))
{t,p} = hhtest(eta,y,mu,h,0.05,1)
t~p

Result:
test statistic, t, and p-value, p.



Author: A. Werwatz, 19960326
(C) MD*TECH Method and Data Technologies, 05.02.2006