Library: | metrics |
See also: | hhtest glmmultlo genmultlo |
Quantlet: | hhmult | |
Description: | hhmult calculates the H-H statistic to jointly test the specification of the link functions of a polychotomous response model (such as the conditional logit model or the multinomial logit model) |
Usage: | {t,p} = hhmult (vhat,y,yhat,h) | |
Input: | ||
vhat | n x M matrix containing the projected indices | |
y | n x M matrix containing n observ. of M binary dependent variables | |
yhat | n x M matrix with the predicted probabilities P(Y_m=1|x) | |
h | 1 x M vector of bandwidths | |
Output: | ||
t | scalar, the value of the test statistic | |
p | scalar, the p-value of t, i.e. 1 - cdfc(t,M) |
library("glm") library("metrics") n = 100 b =(1|2)~(-1|0)~(1|1) x = normal(n,rows(b)) y = genmultlo(x,b) ml = glmmultlo(x,y) vhat= x*ml.b y1 = y.=1 y2 = y.=2 y3 = y.=3 y = y1~y2~y3 c1 = cols(vhat) h = matrix(c1)' yhat= ml.mu {t,p}= hhmult(vhat,y,yhat,h) t~p
test statistic, t, and p-value, p.