Chang ,JX

рассказ и язык

Three Asymptotic Tests: LR, Wald, LM test

Posted by changjx on September 25, 2007

LR test : restricted parameter vector and specify distribution(∵ likelihood function)
Wald test : unrestricted parameter vector only
LM test: restricted parameter vector only, the popular method in econometrics since restricted model is easy to get.

Method 1

#read data
hs1 <- read.table("http://www.ats.ucla.edu/stat/R/notes/hs1.csv", header=T, sep=",") attach(hs1) # classify variable honcomp = 60
honcomp[1:20]
#LR test for logistic reg
lr <- glm(honcomp~female+read, family=binomial) lr2 <- glm(honcomp~female+read+science+math+as.factor(prog), binomial, na.action=na.exclude) drop1(lr2, test="Chisq")

Method 2

see http://cran.r-project.org/src/contrib/Descriptions/lmtest.html
#download the package lmtest
library(lmtest)
lrtest(lr,lr2)
waldtest(lr,lr2)
lmtest(lr,lr2)

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>