| Library: | metrics |
| See also: | hhmult glmest sker |
| Macro: | hhtest | |
| Description: | hhtest calculates the H-H statistic to test the specifi- cation of the link function of a generalized linear model (such as the logit or probit model), assuming the index is correctly specified. |
| 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 | |
library("glm")
x = read("kyphosis.dat")
y = x[,4]
x = x[,1:3]
x = matrix(rows(x))~x
h = 2
{b,bv,mu,h,w,stat,it} = glmbilo(x,y)
library("sim")
library("smoother")
{t,p} = hhtest(eta,y,mu,h,0.05,1)
t~p
test statistic, t, and p-value, p.
| Library: | metrics |
| See also: | hhmult glmest sker |