# Help with syntax for GLM + negative binomial in SPSS

I am applying a GLM (using SPSS v. 18) using negative binomial with log link structure for analyzing the effects of different predictors in crash frequency. From what I understand model form is

$Y = \exp (b_0 + b_1 x_1 + \cdots + b_n x_n)$

However one of the independent variables is an exposure variable, and its effect is different from other independent variables in a way that model form should be:

$Y = b_0 Z^b_1 \exp (b_2 x_2 + \cdots + b_n x_n)$, where $Z$ is the exposure variable and $x\in[2\cdots n]$ are the other explanatory variables

My question is: how to model this using SPSS?

• You'd be better off placing this question on the StackOverflow site as this question is solely focused on programming. – StatsStudent Aug 15 '16 at 16:39
• Questions solely about how software works are off-topic here, but you may have a real statistical question buried here. You may want to edit your question to clarify the underlying statistical issue. You may find that when you understand the statistical concepts involved, the software-specific elements are self-evident or at least easy to get from the documentation. – gung - Reinstate Monica Aug 15 '16 at 17:38

$$E[Y] = \beta_0 \cdot Z^{\beta_1} \cdot \exp( \beta_n X_n)$$
Where $\beta_nX_x$ is just short hand for all of your other independent variables. Lets take the logs of each side, so we are simply talking about the linear predictors on the right hand side:
$$\log ( E[Y] ) = \beta_n X_n + \log(\beta_0 Z^{\beta_1})$$
Note it only makes sense for the exposure term to be positive, and so $\log(\beta_0 Z^{\beta_1})$ can be rewritten as $\log(\beta_0) + \beta_1\log(Z)$. Since $\log(\beta_0)$ is just a constant, if you include an intercept in the usual regression equation it will capture this (but not be identified). To estimate $\beta_1$ you can simply include $\log(Z)$ on the right hand side of the regression equation and estimate its effect - same as all the other independent variables on the right hand side.