[ADMB Users] overdispersion in negative binomial models

dave fournier davef at otter-rsch.com
Sat Dec 1 13:37:50 PST 2012

I was perusing some of the examples and came across Mollie's fir example.

This fits a negative binomial dist to some tree data of some type.
Now with negative binomial distributions I am alway interested in how to
parameterize the overdispersion.  There is a rather widely spread
idea that you "just do it"  and  it has been taken care of.

I think this comes about among R  users at least from the fact that
if you parameterize the overdispersion by a parameter called the
size then the NB is part of an exponential family and so can be handled with
the rather weak techniques available in R.  Then we all pretend there is
no better way and we are all happy.  Not being a member of the faith
I am free to explore other perhaps superior parameterizations.

For a poisson dist the variance is equal to the mean.  For the NB the 
is larger than the mean so

                 var/mu =tau

where tau >1.0

For a NB with  size k the variance is equal to   mu(1+k*mu)  so that

  tau =(1+k*mu)

We see that if the size is constant the overdispersion tau varies with mu.
It is a simple matter to parameterize the model with tau rather than k.
I did this for Mollie's data for her simple model fir0.tpl.  Her results 

> # Number of parameters = 3  Objective function value = 1136.02  
> Maximum gradient component = 0.000405320
> # a:
> 0.303590366248
> # b:
> 2.31984468114
> # k:
> 1.50291272997
with std file

  index   name   value      std.dev
      1   a  3.0359e-01 1.2081e-01
      2   b  2.3198e+00 1.8572e-01
      3   k  1.5029e+00 1.4265e-01

with the tau parameterization the results were

# Number of parameters = 3  Objective function value = 1128.40 Maximum 
gradient component = 2.99340e-06
# a:
# b:
# tau:

with std file

index   name   value      std.dev
      1   a    3.6501e-01 1.3069e-01
      2   b    2.2433e+00 1.5460e-01
      3   tau  2.7519e+01 2.8886e+00

So that the model fits much better.  The value of a (whatever it is) 
seems to have changed
significantly.  Presumably these changes could apply to the random 
effects versions of the
models as well.

Also the UBC function for the NB density returns the negative density
which is a bit confusing.

-------------- next part --------------
	init_int nobs;
	init_vector totcones(1,nobs);
	init_vector dbh(1,nobs);
	init_bounded_number a(.01,10.);
	init_bounded_number b(.01,10.);
	init_bounded_number tau(1.05,100.0);
	vector mu(1,nobs); //store predictions in here
	objective_function_value nll;
	mu=a*pow(dbh, b);
        for (int i=1;i<=nobs;i++)
          //dvariable k=(tau-1.0)/mu(i);
          //nll+=dnbinom(totcones(i), mu(i), k);
          nll-=log_negbinomial_density(totcones(i), mu(i), tau);

	#include <statsLib.h>
-------------- next part --------------

# "fir0.pin" produced by pin_write() from R2admb Sat Dec  1 12:12:52 2012
# a 

# b 

# k 

-------------- next part --------------
# "fir0.pin" produced by pin_write() from R2admb Sat Dec  1 12:12:52 2012
# a 

# b 

# k 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fir0.dat
Type: application/x-ns-proxy-autoconfig
Size: 1813 bytes
Desc: not available
URL: <http://lists.admb-project.org/pipermail/users/attachments/20121201/6a40ca01/attachment.dat>

More information about the Users mailing list