turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Programming negative binomial variance function

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-09-2012 10:12 PM

I apologize for cross-posting, but it was recommended that I pose this question here.

I'm trying to extend the following macro (from Peter Song, Univ Michigan; http://www-personal.umich.edu/~pxsong/qif_package/QIFv02.sas), which fits a quadratic inference function (QIF; a type of marginal generalized linear model akin to generalized estimating equations), to accommodate a negative binomial distribution. The macro is not too long, but I won't copy it here since I've provided a link.

Problem: Implementing a negative binomial distribution QIF

Proposed solution: The negative binomial application should be similar to the Poisson except for the specification of the variance function. Thus, in every place where a Poisson distribution is referenced in the macro, I've added a new section corresponding to the NEGBIN. These sections are identical in all cases (e.g., the calculation of pearson and deviance residuals, the calculation of ui) except in how the variance function is defined. For the Poisson, this particular section of the macro looks like this:

%else %if &dist = POISSON %then %do;

ui = exp( (xi*beta) );

fui = log(ui);

fui_dev = diag(ui);

vui = diag(sqrt(1/ui));

%end;

I think it should look like this for NB:

%else %if &dist = NEGBIN %then %do;

ui = exp( (xi*beta) );

fui = log(ui);

fui_dev = diag(ui)*diag(1+ui);

vui = diag(sqrt(1/ui))*diag(sqrt(1/(1+ui)));

%end;

Rick Wicklin and a colleague suggested a couple of things (their full reply here, clipped below):

First, the potential definition of key terms (I've also requested clarification from the macro author)-

Ui: mean

Fui: ginv(mean), i.e. linear predictor

Fui_dev: diagonal matrix of weights for Fisher scoring = 1/(v(mu)*dg(mu)**2) (not sure about this one: gamma has negative sign?)

Vui: diagonal matrix of inverse of square root of variance.

Second, assuming the above defs are correct, the NegBin parameterization is missing the dispersion parameter "k"; their potential alternative:

Ui = xi*beta

Fui = log(ui)

Fui_dev = diag(ui/(1+k*ui))

Vui = diag( 1/sqrt(ui+k*ui##2))

In this case, an error results as the matrix "k" does not exist. Additionally, I've noticed that when the REPEATED statement is used in GENMOD (invoking the GEE), ML estimates of the scale (or dispersion for NegBin) disappear, perhaps into the "nuisance" variation associated with the clustering?

Thanks very much for any help,

Adam Smith

Department of Natural Resources Science

University of Rhode Island