The NLMIXED Procedure

Built-in Log-Likelihood Functions

This section displays the basic formulas used by the NLMIXED procedure to compute the conditional log-likelihood functions of the data given the random effects. Note, however, that in addition to these basic equations, the NLMIXED procedure employs a number of checks for missing values and floating-point arithmetic. You can see the entire program used by the NLMIXED procedure to compute the conditional log-likelihood functions $l(\bphi ; y)$ by adding the LIST debugging option to the PROC NLMIXED statement.

$Y \sim \mr{normal}(m,v)$
\begin{align*}  l(m,v;y) & = -\frac12 \left( \log \{ 2\pi \}  + \frac{(y-m)^2}{v} + \log \{ v\} \right) \\ \mr{E}[Y] & = m \\ \mr{Var}[Y] & = v \\ v & > 0 \end{align*}
$Y \sim \mr{binary}(p)$
\begin{align*}  l_1(p;y) & = \left\{  \begin{array}{ll} y \, \,  \log \{ p\}  &  y > 0 \cr 0 &  \mr{otherwise} \end{array} \right. \\ l_2(p;y) & = \left\{  \begin{array}{ll} (1-y)\, \,  \log \{ 1-p\}  &  y < 1 \cr 0 &  \mr{otherwise} \end{array} \right. \\ l(p;y) & = l_1(p;y) + l_2(p;y) \\ \mr{E}[Y] & = p \\ \mr{Var}[Y] & = p\, (1-p) \\ 0 & < p < 1 \end{align*}
$Y \sim \mr{binomial}(n,p)$
\begin{align*}  l_ c & = \log \{ \Gamma (n+1)\}  - \log \{ \Gamma (y+1)\}  - \log \{ \Gamma (n-y+1)\}  \\ l_1(n,p;y) & = \left\{  \begin{array}{ll} y \, \,  \log \{ p\}  &  y > 0 \cr 0 &  \mr{otherwise} \end{array} \right. \\ l_2(n,p;y) & = \left\{  \begin{array}{ll} (n-y)\, \,  \log \{ 1-p\}  &  n-y > 0 \cr 0 &  \mr{otherwise} \end{array} \right. \\ l(n,p;y) & = l_ c + l_1(n,p;y) + l_2(n,p;y) \\ \mr{E}[Y] & = n\, p \\ \mr{Var}[Y] & = n\, p\, (1-p) \\ 0 & < p < 1 \end{align*}
$Y \sim \mr{gamma}(a,b)$
\begin{align*}  l(a,b;y) & = -a\log \{ b\}  - \log \{ \Gamma (a)\}  + (a-1)\log \{ y\}  - y/b \\ \mr{E}[Y] & = ab \\ \mr{Var}[Y] & = ab^2 \\ a & > 0 \\ b & > 0 \end{align*}

This parameterization of the gamma distribution differs from the parameterization used in the GLIMMIX and GENMOD procedures. The following statements show the equivalent reparameterization in the NLMIXED procedure that fits a generalized linear model for gamma-distributed data in the parameterization of the GLIMMIX procedure:

proc glimmix;
   model y = x / dist=gamma s;
run;

proc nlmixed;
   parms b0=1 b1=0 scale=14;
   linp = b0 + b1*x;
   mu   = exp(linp);
   b    = mu/scale;
   model y ~ gamma(scale,b);
run;
$Y \sim \mr{negbin}(n,p)$
\begin{align*}  l(n,p;y) & = \log \{ \Gamma (n+y)\}  - \log \{ \Gamma (n)\}  - \log \{ \Gamma (y+1)\}  \\ & \mbox{ } +n \log \{ p\}  + y \log \{ 1-p\}  \\ \mr{E}[Y] & = nP = n\left(\frac{1-p}{p}\right)\\ \mr{Var}[Y] & = nP(1-P) = n\left(\frac{1-p}{p}\right)\frac{1}{p}\\ n & \ge 0 \\ 0 & < p < 1 \end{align*}

This form of the negative binomial distribution is one of the many parameterizations in which the mass function or log-likelihood function appears. Another common parameterization uses

\begin{align*}  l(n,p;y) & = \log \{ \Gamma (n+y)\}  - \log \{ \Gamma (n)\}  - \log \{ \Gamma (y+1)\}  \\ & \mbox{ } +n \log \{ 1-P/(1+P)\}  + y \log \{ P/(1+P)\}  \end{align*}

with $P = (1-p)/p$, $P > 0$.

Note that the parameter n can be real-numbered; it does not have to be integer-valued. The parameterization of the negative binomial distribution in the NLMIXED procedure differs from that in the GLIMMIX and GENMOD procedures. The following statements show the equivalent formulations for maximum likelihood estimation in the GLIMMIX and NLMIXED procedures in a negative binomial regression model:

proc glimmix;
   model y = x / dist=negbin s;
run;

proc nlmixed;
   parms b0=3, b1=1, k=0.8;
   linp = b0 + b1*x;
   mu = exp(linp);
   p  = 1/(1+mu*k);
   model y ~ negbin(1/k,p);
run;
$Y \sim \mr{Poisson}(m)$
\begin{align*}  l(m;y) & = y \log \{ m\}  - m - \log \{ \Gamma (y + 1)\} \\ \mr{E}[Y] & = m \\ \mr{Var}[Y] & = m \\ m & > 0 \end{align*}