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

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)$
$\displaystyle  l(n,p;y)  $
$\displaystyle = \log \{ \Gamma (n+y)\}  - \log \{ \Gamma (n)\}  - \log \{ \Gamma (y+1)\}   $
$\displaystyle  $
$\displaystyle \mbox{ } +n \log \{ p\}  + y \log \{ 1-p\}   $
$\displaystyle \mr {E}[Y]  $
$\displaystyle = nP = n\left(\frac{1-p}{p}\right) $
$\displaystyle \mr {Var}[Y]  $
$\displaystyle = nP(1-P) = n\left(\frac{1-p}{p}\right)\frac{1}{p} $
$\displaystyle n  $
$\displaystyle \ge 0  $
$\displaystyle 0  $
$\displaystyle < p < 1  $

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

$\displaystyle  l(n,p;y)  $
$\displaystyle = \log \{ \Gamma (n+y)\}  - \log \{ \Gamma (n)\}  - \log \{ \Gamma (y+1)\}   $
$\displaystyle  $
$\displaystyle \mbox{ } +n \log \{ 1-P/(1+P)\}  + y \log \{ P/(1+P)\}   $

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)$
$\displaystyle  l(m;y)  $
$\displaystyle = y \log \{ m\}  - m - \log \{ \Gamma (y + 1)\}  $
$\displaystyle \mr {E}[Y]  $
$\displaystyle = m  $
$\displaystyle \mr {Var}[Y]  $
$\displaystyle = m  $
$\displaystyle m  $
$\displaystyle > 0  $