lrtest(VGAM)
lrtest()所属R语言包:VGAM
Likelihood Ratio Test of Nested Models
嵌套模型的似然比检验
译者:生物统计家园网 机器人LoveR
描述----------Description----------
lrtest is a generic function for carrying out likelihood ratio tests. The default method can be employed for comparing nested VGLMs (see details below).
lrtest是一个通用函数进行似然比检验。默认的方法可以采用比较的嵌套VGLMs(详见下文)。
用法----------Usage----------
lrtest(object, ...)
lrtest_vglm(object, ..., name = NULL)
参数----------Arguments----------
参数:object
a vglm object. See below for details.
一个vglm对象。有关详细信息,请参见下文。
参数:...
further object specifications passed to methods. See below for details.
进一步传递给方法的对象规范。有关详细信息,请参见下文。
参数:name
a function for extracting a suitable name/description from a fitted model object. By default the name is queried by calling formula.
从拟合模型对象中提取一个合适的名称/描述的功能。默认情况下,名称是通过调用formula查询。
Details
详细信息----------Details----------
lrtest is intended to be a generic function for comparisons of models via asymptotic likelihood ratio tests. The default method consecutively compares the fitted model object object with the models passed in .... Instead of passing the fitted model objects in ..., several other specifications are possible. The updating mechanism is the same as for waldtest: the models in ... can be specified as integers, characters (both for terms that should be eliminated from the previous model), update formulas or fitted model objects. Except for the last case, the existence of an update method is assumed. See waldtest for details.
lrtest的目的是通过渐进的似然比检验模型的比较是一个通用的功能。连续的默认方法比较合适的模型对象object,与模型通过在...。而不是通过拟合模型中的对象...,其他几个规格是可能的。更新机制是一样的waldtest:该机型在...可以被指定为整数,字符(包括从以前的模式,应该被淘汰的条款),更新公式或模型拟合对象。除最后一种情况下,假定存在的update方法。见waldtest的详细信息。
Subsequently, an asymptotic likelihood ratio test for each two consecutive models is carried out: Twice the difference in log-likelihoods (as derived by the logLik methods) is compared with a Chi-squared distribution.
随后,每两个连续的模式是一个渐进似然比检验进行了两次相比,卡方分布的差异对数似然性(派生的logLik方法)。
值----------Value----------
An object of class "VGAManova" which contains a slot with the log-likelihood, degrees of freedom, the difference in degrees of freedom, likelihood ratio Chi-squared statistic and corresponding p value. These are printed by stats:::print.anova(); see anova.
对象的类"VGAManova"包含的插槽,对数似然度的自由,自由度的差异,似然比卡方统计量和相应的p值。这些打印stats:::print.anova()见anova。
警告----------Warning ----------
Several VGAM family functions implement distributions which do not satisfying the usual regularity conditions needed for the LRT to work. No checking or warning is given for these.
几个VGAM家庭功能的实现分布不符合通常的规律性轻铁工作需要的条件。这些未进行任何检查或发出警告。
注意----------Note----------
The code was adapted directly from lmtest (written by T. Hothorn, A. Zeileis, G. Millo, D. Mitchell) and made to work for VGLMs and S4. This help file also was adapted from lmtest.
该代码是直接从适应lmtest(T. Hothorn,A. Zeileis,G.米罗,D.米切尔写的)和所做的工作,为VGLMs和S4。此帮助文件也改编自lmtest。
Approximate LRTs might be applied to VGAMs, as produced by vgam, but it is probably better in inference to use vglm with regression splines (bs and ns). This methods function should not be applied to other models such as those produced by rrvglm, by cqo, by cao.
约LRTS可能产生的vgamVGAMs,但它可能是更好的推理使用vglm回归样条曲线(bs和ns)。此方法的功能不应该被应用到其他车型,如产生rrvglm,cqo,cao。
参见----------See Also----------
lmtest, vglm.
lmtest,vglm。
实例----------Examples----------
set.seed(1)
pneumo = transform(pneumo, let = log(exposure.time), x3 = runif(nrow(pneumo)))
fit1 = vglm(cbind(normal, mild, severe) ~ let , propodds, pneumo)
fit2 = vglm(cbind(normal, mild, severe) ~ let + x3, propodds, pneumo)
fit3 = vglm(cbind(normal, mild, severe) ~ let , cumulative, pneumo)
# Various equivalent specifications of the LR test for testing x3[同等规格的LR测试各种测试X3]
(ans1 <- lrtest(fit2, fit1))
ans2 <- lrtest(fit2, 2)
ans3 <- lrtest(fit2, "x3")
ans4 <- lrtest(fit2, . ~ . - x3)
c(all.equal(ans1, ans2), all.equal(ans1, ans3), all.equal(ans1, ans4))
# Doing it manually[做手工]
(testStatistic <- 2 * (logLik(fit2) - logLik(fit1)))
(mypval <- pchisq(testStatistic, df = length(coef(fit2)) - length(coef(fit1)),
lower.tail = FALSE))
(ans4 <- lrtest(fit3, fit1)) # Test proportional odds (parallelism) assumption[测试比例优势的假设(平行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|