[R] Vuong test

178 views
Skip to first unread message

sanchez ana

unread,
Jul 13, 2012, 1:35:02 AM7/13/12
to r-h...@r-project.org, sanchezana
Dear All,

I am using the function vuong from pscl package to compare 2 non nested models NB1
(negative binomial I ) and Zero-inflated model.


NB1 <-  glm(, , family = quasipoisson), it is an
object of class: "glm" "lm"
zinb <-
zeroinfl( dist = "negbin") is an object of class: "zeroinfl"
 
when applying vuong
function I get the following:
vuong(NB1, zinb)
Error en predprob.glm(m1) :
  your object of class glm is unsupported by
predprob.glmyour object of class lm is unsupported by predprob.glm


Any help will be really appreciated.
[[alternative HTML version deleted]]

Marc Schwartz

unread,
Jul 13, 2012, 8:36:26 AM7/13/12
to sanchez ana, r-h...@r-project.org
Either you did not properly copy your code above or something is amiss in your understanding.

NB1 is NOT a negative binomial model, but is a quasipoisson model. The latter is not fit using maximum likelihood, hence the Vuong test, which is a likelihood ratio based test, fails.

If you want a negative binomial model, you should be using glm.nb() in V&R's MASS package:

require(MASS)
NB1 <- glm.nb(...)

Then you can use the Vuong test from pscl.

If you have not, you might want to read:

vignette("countreg")

Regards,

Marc Schwartz

______________________________________________
R-h...@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.

sanchez ana

unread,
Jul 14, 2012, 1:35:00 PM7/14/12
to Marc Schwartz, r-h...@r-project.org
Dear Dr. Schwartz,
 
Thanks so much
 
Ana


>________________________________
> De: Marc Schwartz <marc_s...@me.com>
>Para: sanchez ana <paola...@yahoo.com.mx>
>CC: "r-h...@R-project.org" <r-h...@r-project.org>
>Enviado: Viernes, 13 de julio, 2012 7:36:26
>Asunto: Re: [R] Vuong test
[[alternative HTML version deleted]]

sanchez ana

unread,
Jul 14, 2012, 1:40:32 PM7/14/12
to paola...@hotmail.com, r-h...@r-project.org
Dear all,
 
I am
fitting  a hurdle model in the following way:
HNB <-
hurdle(chro ~ as.factor(TandemRepeat)| as.factor(TandemRepeat), data =data_negbin_fin,
dist = "negbin")
But the std.
error for log(theta) = NA
Count model
coefficients (truncated negbin with log link):
                                 Estimate      Std. Error     z value       Pr(>|z|)   
Log(theta)                13.5062         NA                NA           NA  
And it
gives the following  message:
In
sqrt(diag(vc_count)[kx + 1]) : NaNs
Can
somebody help me please.
Thanks so
much
 
Ana


>________________________________
> De: Marc Schwartz <marc_s...@me.com>
>Para: sanchez ana <paola...@yahoo.com.mx>
>CC: "r-h...@R-project.org" <r-h...@r-project.org>
>Enviado: Viernes, 13 de julio, 2012 7:36:26
>Asunto: Re: [R] Vuong test
>
>
[[alternative HTML version deleted]]

sanchez ana

unread,
Jul 14, 2012, 1:44:36 PM7/14/12
to sanchezana, r-h...@r-project.org
Dear all,
I am
fitting  a hurdle model in the following way:
HNB <-
hurdle(chro ~ as.factor(TandemRepeat)| as.factor(TandemRepeat), data =data_negbin_fin,
dist = "negbin")
But the std.
error for log(theta) = NA
Count model
coefficients (truncated negbin with log link):
                                 Estimate      Std. Error     z value       Pr(>|z|)   
Log(theta)                13.5062         NA                NA           NA  
 
And it
gives the following error:
In
sqrt(diag(vc_count)[kx + 1]) : NaNs
 
Can
somebody help me please.
Thanks so
much
 
Ana
[[alternative HTML version deleted]]

sanchez ana

unread,
Jul 14, 2012, 1:53:53 PM7/14/12
to Marc Schwartz, r-h...@r-project.org
Dear Dr. Schwartz,
 
I would like to ask you if you know how to fit NB1 with glm.nb(...), because glm.nb() is actually fitting NB2.
 
Thanks so much
 
Ana



>________________________________
> De: Marc Schwartz <marc_s...@me.com>
>Para: sanchez ana <paola...@yahoo.com.mx>
>CC: "r-h...@R-project.org" <r-h...@r-project.org>
>Enviado: Viernes, 13 de julio, 2012 7:36:26
>Asunto: Re: [R] Vuong test
>
>
[[alternative HTML version deleted]]

Highland Statistics Ltd

unread,
Jul 15, 2012, 6:51:37 AM7/15/12
to r-h...@r-project.org
Simplify your model. Does your TandemRepeat have a lot of levels? Or is
your sample size very small?

Alain
--

Dr. Alain F. Zuur
First author of:

1. Analysing Ecological Data (2007).
Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p.
URL: www.springer.com/0-387-45967-7


2. Mixed effects models and extensions in ecology with R. (2009).
Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer.
http://www.springer.com/life+sci/ecology/book/978-0-387-87457-9


3. A Beginner's Guide to R (2009).
Zuur, AF, Ieno, EN, Meesters, EHWG. Springer
http://www.springer.com/statistics/computational/book/978-0-387-93836-3


4. Zero Inflated Models and Generalized Linear Mixed Models with R. (2012) Zuur, Saveliev, Ieno.
http://www.highstat.com/book4.htm

Other books: http://www.highstat.com/books.htm


Statistical consultancy, courses, data analysis and software
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Tel: 0044 1358 788177
Email: high...@highstat.com
URL: www.highstat.com
URL: www.brodgar.com


[[alternative HTML version deleted]]
Reply all
Reply to author
Forward
0 new messages