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 left-parenthesis bold-italic phi semicolon y right-parenthesis by adding the LIST debugging option to the PROC NLMIXED statement.

upper Y tilde normal n normal o normal r normal m normal a normal l left-parenthesis m comma v right-parenthesis
StartLayout 1st Row 1st Column l left-parenthesis m comma v semicolon y right-parenthesis 2nd Column equals minus one-half left-parenthesis log left-brace 2 pi right-brace plus StartFraction left-parenthesis y minus m right-parenthesis squared Over v EndFraction plus log left-brace v right-brace right-parenthesis 2nd Row 1st Column normal upper E left-bracket upper Y right-bracket 2nd Column equals m 3rd Row 1st Column normal upper V normal a normal r left-bracket upper Y right-bracket 2nd Column equals v 4th Row 1st Column v 2nd Column greater-than 0 EndLayout
upper Y tilde normal b normal i normal n normal a normal r normal y left-parenthesis p right-parenthesis
StartLayout 1st Row 1st Column l 1 left-parenthesis p semicolon y right-parenthesis 2nd Column equals StartLayout Enlarged left-brace 1st Row 1st Column y log left-brace p right-brace 2nd Column y greater-than 0 2nd Row 1st Column 0 2nd Column normal o normal t normal h normal e normal r normal w normal i normal s normal e EndLayout 2nd Row 1st Column l 2 left-parenthesis p semicolon y right-parenthesis 2nd Column equals StartLayout Enlarged left-brace 1st Row 1st Column left-parenthesis 1 minus y right-parenthesis log left-brace 1 minus p right-brace 2nd Column y less-than 1 2nd Row 1st Column 0 2nd Column normal o normal t normal h normal e normal r normal w normal i normal s normal e EndLayout 3rd Row 1st Column l left-parenthesis p semicolon y right-parenthesis 2nd Column equals l 1 left-parenthesis p semicolon y right-parenthesis plus l 2 left-parenthesis p semicolon y right-parenthesis 4th Row 1st Column normal upper E left-bracket upper Y right-bracket 2nd Column equals p 5th Row 1st Column normal upper V normal a normal r left-bracket upper Y right-bracket 2nd Column equals p left-parenthesis 1 minus p right-parenthesis 6th Row 1st Column 0 2nd Column less-than p less-than 1 EndLayout
upper Y tilde normal b normal i normal n normal o normal m normal i normal a normal l left-parenthesis n comma p right-parenthesis
StartLayout 1st Row 1st Column l Subscript c 2nd Column equals log left-brace normal upper Gamma left-parenthesis n plus 1 right-parenthesis right-brace minus log left-brace normal upper Gamma left-parenthesis y plus 1 right-parenthesis right-brace minus log left-brace normal upper Gamma left-parenthesis n minus y plus 1 right-parenthesis right-brace 2nd Row 1st Column l 1 left-parenthesis n comma p semicolon y right-parenthesis 2nd Column equals StartLayout Enlarged left-brace 1st Row 1st Column y log left-brace p right-brace 2nd Column y greater-than 0 2nd Row 1st Column 0 2nd Column normal o normal t normal h normal e normal r normal w normal i normal s normal e EndLayout 3rd Row 1st Column l 2 left-parenthesis n comma p semicolon y right-parenthesis 2nd Column equals StartLayout Enlarged left-brace 1st Row 1st Column left-parenthesis n minus y right-parenthesis log left-brace 1 minus p right-brace 2nd Column n minus y greater-than 0 2nd Row 1st Column 0 2nd Column normal o normal t normal h normal e normal r normal w normal i normal s normal e EndLayout 4th Row 1st Column l left-parenthesis n comma p semicolon y right-parenthesis 2nd Column equals l Subscript c Baseline plus l 1 left-parenthesis n comma p semicolon y right-parenthesis plus l 2 left-parenthesis n comma p semicolon y right-parenthesis 5th Row 1st Column normal upper E left-bracket upper Y right-bracket 2nd Column equals n p 6th Row 1st Column normal upper V normal a normal r left-bracket upper Y right-bracket 2nd Column equals n p left-parenthesis 1 minus p right-parenthesis 7th Row 1st Column 0 2nd Column less-than p less-than 1 EndLayout
upper Y tilde normal g normal a normal m normal m normal a left-parenthesis a comma b right-parenthesis
StartLayout 1st Row 1st Column l left-parenthesis a comma b semicolon y right-parenthesis 2nd Column equals minus a log left-brace b right-brace minus log left-brace normal upper Gamma left-parenthesis a right-parenthesis right-brace plus left-parenthesis a minus 1 right-parenthesis log left-brace y right-brace minus y slash b 2nd Row 1st Column normal upper E left-bracket upper Y right-bracket 2nd Column equals a b 3rd Row 1st Column normal upper V normal a normal r left-bracket upper Y right-bracket 2nd Column equals a b squared 4th Row 1st Column a 2nd Column greater-than 0 5th Row 1st Column b 2nd Column greater-than 0 EndLayout

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;
upper Y tilde normal n normal e normal g normal b normal i normal n left-parenthesis n comma p right-parenthesis
StartLayout 1st Row 1st Column l left-parenthesis n comma p semicolon y right-parenthesis 2nd Column equals log left-brace normal upper Gamma left-parenthesis n plus y right-parenthesis right-brace minus log left-brace normal upper Gamma left-parenthesis n right-parenthesis right-brace minus log left-brace normal upper Gamma left-parenthesis y plus 1 right-parenthesis right-brace 2nd Row 1st Column Blank 2nd Column plus n log left-brace p right-brace plus y log left-brace 1 minus p right-brace 3rd Row 1st Column normal upper E left-bracket upper Y right-bracket 2nd Column equals n upper P equals n left-parenthesis StartFraction 1 minus p Over p EndFraction right-parenthesis 4th Row 1st Column normal upper V normal a normal r left-bracket upper Y right-bracket 2nd Column equals n upper P left-parenthesis 1 minus upper P right-parenthesis equals n left-parenthesis StartFraction 1 minus p Over p EndFraction right-parenthesis StartFraction 1 Over p EndFraction 5th Row 1st Column n 2nd Column greater-than-or-equal-to 0 6th Row 1st Column 0 2nd Column less-than p less-than 1 EndLayout

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

StartLayout 1st Row 1st Column l left-parenthesis n comma p semicolon y right-parenthesis 2nd Column equals log left-brace normal upper Gamma left-parenthesis n plus y right-parenthesis right-brace minus log left-brace normal upper Gamma left-parenthesis n right-parenthesis right-brace minus log left-brace normal upper Gamma left-parenthesis y plus 1 right-parenthesis right-brace 2nd Row 1st Column Blank 2nd Column plus n log left-brace 1 minus upper P slash left-parenthesis 1 plus upper P right-parenthesis right-brace plus y log left-brace upper P slash left-parenthesis 1 plus upper P right-parenthesis right-brace EndLayout

with upper P equals left-parenthesis 1 minus p right-parenthesis slash p, upper P greater-than 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;
upper Y tilde normal upper P normal o normal i normal s normal s normal o normal n left-parenthesis m right-parenthesis
StartLayout 1st Row 1st Column l left-parenthesis m semicolon y right-parenthesis 2nd Column equals y log left-brace m right-brace minus m minus log left-brace normal upper Gamma left-parenthesis y plus 1 right-parenthesis right-brace 2nd Row 1st Column normal upper E left-bracket upper Y right-bracket 2nd Column equals m 3rd Row 1st Column normal upper V normal a normal r left-bracket upper Y right-bracket 2nd Column equals m 4th Row 1st Column m 2nd Column greater-than 0 EndLayout
Last updated: December 09, 2022