1
votes

I have a count data and I need to do time series analysis using Dynamic negative binomial regression as the data has autocorrelation and Overdispersion issues. I did an online search for any R package that I can use but I was not able to find one.

I would appreciate any help.

An example of my data:

>St1
[1] 17  9 28  7 23 16 17 12 11 16 19 29  5 40 13 27 13 11 10 14 13 23 21 24  9 42 14 22 17  9

>Years
 [1] 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006
[23] 2007 2008 2009 2010 2011 2012 2013 2014

>library(AER)
>library(stats)

>rd <- glm(St1 ~ Years, family = poisson)
>dispersiontest(rd) 

Overdispersion test
data:  rd
z = 2.6479, p-value = 0.00405
alternative hypothesis: true dispersion is greater than 1
sample estimates:
dispersion 
  4.305539 

#Autocorrelation
>Box.test (St1, lag=ceiling(log(length(St1))), type = "Ljung")

    Box-Ljung test

data:  St1
X-squared = 13.612, df = 4, p-value = 0.008641
1
You should probably offer a link to a methodology-oriented webpage that illustrates "dynamic binomial regression". The work "dynamic" can take on so many meanings that it is really meaning-_less_> - IRTFM
Thanks. My understanding is that dynamic negative binomial regression can account for autocorrelation and overdispersion. See this please journals.sagepub.com/doi/pdf/10.1177/1471082X14535530 - Ali

1 Answers

2
votes

So this is basically a request to find a package (and such requests are considered off-topic). So I'm going to see if I can convert it to a question that has a coding flavor. As I said in my comment, trying to use "dynamic" as a search term is often disappointing since everybody seems to want to use the word for a bunch of disconnected purposes. Witness the functions that come up with this search from the console:

install.packages("sos")
sos::findFn(" dynamic negative binomial")
found 20 matches
Downloaded 20 links in 13 packages.

Nothing that appeared useful. But looking at your citation it appeared that all the models had an autoreggression component, so this search ....

sos::findFn(" autoregressive negative binomial")
found 28 matches;  retrieving 2 pages
2 
Downloaded 27 links in 16 packages.

Finds: "Fitting Longitudinal Data with Negative Binomial Marginal..." and "Generalized Linear Autoregressive Moving Average Models with...". So consider this rather my answer to an "implicit question": How to do effective searching from the R console with the sos-package?