[R] anova.rq {quantreg) - Why do different level of nesting changes the P values?!

Eik Vettorazzi E.Vettorazzi at uke.de
Thu Oct 6 13:21:52 CEST 2011


Hi Tal,
you are comparing different things. The "Details"-section of ?anova.qr
states "test the hypothesis that smaller models are adequate relative to
the largest specified model". So in your first anova you compare fit2
with fit1 and fit0, in your second attempt fit1 with fit0, so you have
different "base"-models to compare with, and consequently different
p-values.

hth.

Am 06.10.2011 10:05, schrieb Tal Galili:
> Hello dear R help members.
> 
> I am trying to understand the anova.rq, and I am finding something which I
> can not explain (is it a bug?!):
> 
> The example is for when we have 3 nested models.  I run the anova once on
> the two models, and again on the three models.  I expect that the p.value
> for the comparison of model 1 and model 2 would remain the same, whether or
> not I add a third model to be compared with.
> However, the P values change, and I do not understand why.
> 
> Here is an example code (following with it's input):
> 
> data(barro)
> fit0 <- rq(y.net ~  lgdp2 + fse2 , data = barro)
> fit1 <- rq(y.net ~  lgdp2 + fse2 + gedy2 , data = barro)
> fit2 <- rq(y.net ~  lgdp2 + fse2 + gedy2 + Iy2 , data = barro)
> anova(fit0,fit1,fit2, R = 1000)
> anova(fit0,fit1, R = 1000)
> 
> 
> Output:
> 
>> data(barro)
>> fit0 <- rq(y.net ~  lgdp2 + fse2 , data = barro)
>> fit1 <- rq(y.net ~  lgdp2 + fse2 + gedy2 , data = barro)
>> fit2 <- rq(y.net ~  lgdp2 + fse2 + gedy2 + Iy2 , data = barro)
>> anova(fit0,fit1,fit2, R = 1000)
> Quantile Regression Analysis of Deviance Table
> 
> Model 1: y.net ~ lgdp2 + fse2 + gedy2 + Iy2
> Model 2: y.net ~ lgdp2 + fse2 + gedy2
> Model 3: y.net ~ lgdp2 + fse2
>   Df Resid Df F value    Pr(>F)
> 1  1      156  29.494 2.110e-07 ***
> 2  2      156  18.194 7.901e-08 ***
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>> anova(fit0,fit1, R = 1000)
> Quantile Regression Analysis of Deviance Table
> 
> Model 1: y.net ~ lgdp2 + fse2 + gedy2
> Model 2: y.net ~ lgdp2 + fse2
>   Df Resid Df F value  Pr(>F)
> 1  1      157  3.9532 0.04852 *
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>> sessionInfo()
> R version 2.13.1 (2011-07-08)
> Platform: i386-pc-mingw32/i386 (32-bit)
> 
> locale:
> [1] LC_COLLATE=Hebrew_Israel.1255  LC_CTYPE=Hebrew_Israel.1255
> [3] LC_MONETARY=Hebrew_Israel.1255 LC_NUMERIC=C
> [5] LC_TIME=Hebrew_Israel.1255
> 
> attached base packages:
> [1] splines   stats     graphics  grDevices utils     datasets  methods
> base
> 
> other attached packages:
>  [1] rms_3.3-1                    Hmisc_3.8-3
>  survival_2.36-9
>  [4] colorspace_1.1-0             quantreg_4.71                SparseM_0.89
> 
>  [7] PerformanceAnalytics_1.0.3.2 xts_0.8-2                    zoo_1.7-4
> 
> [10] reporttools_1.0.6            xtable_1.5-6
> 
> loaded via a namespace (and not attached):
> [1] cluster_1.14.0  grid_2.13.1     lattice_0.19-33 tools_2.13.1
> 
> 
> 
> 
> 
> 
> ----------------Contact
> Details:-------------------------------------------------------
> Contact me: Tal.Galili at gmail.com |  972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
> ----------------------------------------------------------------------------------------------
> 
> 	[[alternative HTML version deleted]]
> 
> 
> 
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


-- 
Eik Vettorazzi

Department of Medical Biometry and Epidemiology
University Medical Center Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790

--
Pflichtangaben gemäß Gesetz über elektronische Handelsregister und Genossenschaftsregister sowie das Unternehmensregister (EHUG):

Universitätsklinikum Hamburg-Eppendorf; Körperschaft des öffentlichen Rechts; Gerichtsstand: Hamburg

Vorstandsmitglieder: Prof. Dr. Guido Sauter (Vertreter des Vorsitzenden), Dr. Alexander Kirstein, Joachim Prölß, Prof. Dr. Dr. Uwe Koch-Gromus 



More information about the R-help mailing list