
\documentclass[notitlepage,12pt]{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amsmath}

\setcounter{MaxMatrixCols}{10}
%TCIDATA{OutputFilter=LATEX.DLL}
%TCIDATA{Version=5.00.0.2606}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{Created=Fri Dec 24 08:35:56 1999}
%TCIDATA{LastRevised=Monday, August 22, 2005 10:03:55}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}
%TCIDATA{<META NAME="DocumentShell" CONTENT="Journal Articles\Standard LaTeX Article">}
%TCIDATA{Language=American English}
%TCIDATA{CSTFile=40 LaTeX article.cst}

\input{tcilatex}
\input jslfloat
\input jsl1in
\raggedbottom

\begin{document}


\begin{center}
{\Large Using the Delta Method to Construct Confidence Intervals for
Predicted Probabilities, Rates, and Discrete Changes}{\footnotesize \bigskip 
}

{\large Jun Xu and J.\ Scott Long}\bigskip

Indiana University \bigskip

August 22, 2005{\large \bigskip }
\end{center}

The paper provides technical details on the methods described in Jun Xu and
J. Scott Long (forthcoming) \textquotedblleft Confidence Intervals for
Predicted Outcomes in Regression Models for Categorical
Outcomes\textquotedblright\ \textit{The Stata Journal}. These formula were
incorporated into \texttt{prvalue}. See www.indiana.edu/\symbol{126}%
jslsoc/spost.htm for further details.

\section{General Formula}

The delta method is a general approach for computing confidence intervals
for functions of maximum likelihood estimates. The delta method takes a
function that is too complex for analytically computing the variance,
creates a linear approximation of that function, and then computes the
variance of the simpler linear function that can be used for large sample
inference.

We begin with a general result for maximum likelihood theory. Under standard
regularity conditions, if $\widehat{\mathbf{\beta }}$ is a vector of ML
estimates, then%
\begin{equation}
\sqrt{n}\left( \widehat{\mathbf{\beta }}-\mathbf{\beta }\right) \overset{d}{%
\rightarrow }N\left[ \mathbf{0,}Var\left( \widehat{\mathbf{\beta }}\right) %
\right] \ .
\end{equation}%
Let $G\left( \mathbf{\beta }\right) $ be some function, such as predicted
probabilities from a logit or ordinal logit model. The Taylor series
expansion of $G(\widehat{\mathbf{\beta }})$ is%
\begin{eqnarray}
G(\widehat{\mathbf{\beta }}) &=&G(\mathbf{\beta })+(\widehat{\mathbf{\beta }}%
-\mathbf{\beta })^{\prime }G^{\prime }(\mathbf{\beta })+(\widehat{\mathbf{%
\beta }}-\mathbf{\beta })^{\prime }G^{\prime \prime }(\mathbf{\beta }^{\ast
})(\widehat{\mathbf{\beta }}-\mathbf{\beta })/2 \\
&\approx &G(\mathbf{\beta })+(\widehat{\mathbf{\beta }}-\mathbf{\beta }%
)^{\prime }G^{\prime }(\mathbf{\beta })\text{ ,}  \notag
\end{eqnarray}%
where $G^{\prime }(\mathbf{\beta })$ and $G^{\prime \prime }(\mathbf{\beta })
$ are matrices of first and second partial derivatives with respect to $%
\mathbf{\beta ,}$ $\mathbf{\beta }^{\ast }$ is some value between $\widehat{%
\mathbf{\beta }}$ and $\mathbf{\beta .}$ Then, 
\begin{equation}
\sqrt{n}\left[ G(\widehat{\mathbf{\beta }})-G(\mathbf{\beta })\right]
\approx \sqrt{n}(\widehat{\mathbf{\beta }}-\mathbf{\beta })^{\prime
}G^{\prime }(\mathbf{\beta })\ .
\end{equation}%
This leads to leads to $G(\widehat{\mathbf{\beta }})\rightarrow N\left( G(%
\mathbf{\beta }),\frac{\partial G(\mathbf{\beta })}{\partial \mathbf{\beta }%
^{\prime }}Var(\widehat{\mathbf{\beta }})\frac{\partial G(\mathbf{\beta })}{%
\partial \mathbf{\beta }}\right) $ (Greene 2000; Agresti 2002). To estimate
the variance, we evaluate the partials at the ML\ estimates, $\left. \frac{%
\partial G(\mathbf{\beta }|\mathbf{x})}{\partial \mathbf{\beta }^{\prime }}%
\right\vert _{\mathbf{\beta }=\widehat{\mathbf{\beta }}}$, which leads to%
\begin{equation}
\text{\textit{Var}}\left( G(\widehat{\mathbf{\beta }})\right) =\frac{%
\partial G(\widehat{\mathbf{\beta }})}{\partial \widehat{\mathbf{\beta }}%
^{\prime }}Var(\widehat{\mathbf{\beta }})\frac{\partial G(\widehat{\mathbf{%
\beta }})}{\partial \widehat{\mathbf{\beta }}}\ .  \label{VarDelta}
\end{equation}

For example, consider the logit model with%
\begin{equation}
G(\mathbf{\beta })=\Pr \left( y=1\mid \mathbf{x}\right) =\Lambda \left( 
\mathbf{x}^{\prime }\mathbf{\beta }\right) \ .
\end{equation}%
To compute the confidence interval, we need the gradient vector%
\begin{equation}
\frac{\partial G(\mathbf{\beta })}{\partial \mathbf{\beta }}=\left[ 
\begin{array}{cccc}
\frac{\partial \Lambda \left( \mathbf{x}^{\prime }\mathbf{\beta }\right) }{%
\partial \beta _{0}} & \frac{\partial \Lambda \left( \mathbf{x}^{\prime }%
\mathbf{\beta }\right) }{\partial \beta _{1}} & \cdots  & \frac{\partial
\Lambda \left( \mathbf{x}^{\prime }\mathbf{\beta }\right) }{\partial \beta
_{K}}%
\end{array}%
\right] ^{\prime }\ .
\end{equation}%
Since $\Lambda $ is a cdf, $\frac{\partial \Lambda \left( \mathbf{x}^{\prime
}\mathbf{\beta }\right) }{\partial \beta _{k}}=\frac{\partial \Lambda \left( 
\mathbf{x}^{\prime }\mathbf{\beta }\right) }{\partial \mathbf{x}^{\prime }%
\mathbf{\beta }}\frac{\partial \mathbf{x}^{\prime }\mathbf{\beta }}{\partial
\beta _{k}}=\lambda \left( \mathbf{x}^{\prime }\mathbf{\beta }\right) x_{k}$%
. Then%
\begin{equation}
\frac{\partial G(\mathbf{\beta })}{\partial \mathbf{\beta }}=\left[ 
\begin{array}{cccc}
\lambda \left( \mathbf{x}^{\prime }\mathbf{\beta }\right)  & \lambda \left( 
\mathbf{x}^{\prime }\mathbf{\beta }\right) x_{1} & \cdots  & \lambda \left( 
\mathbf{x}^{\prime }\mathbf{\beta }\right) x_{K}%
\end{array}%
\right] ^{\prime }\text{ .}
\end{equation}%
To compute the confidence interval for a change in the probability as the
independent variables change from $\mathbf{x}_{a}$ to $\mathbf{x}_{b}$, we
use the function%
\begin{equation}
G\left( \mathbf{\beta }\right) =\Lambda (\mathbf{\beta }|\mathbf{x}%
_{a})-\Lambda \left( \mathbf{\beta }|\mathbf{x}_{b}\right) \ ,
\end{equation}%
where%
\begin{eqnarray}
\frac{\partial G(\mathbf{\beta })}{\partial \mathbf{\beta }} &=&\frac{%
\partial \left[ \Lambda (\mathbf{\beta }|\mathbf{x}_{a})-\Lambda (\mathbf{%
\beta }|\mathbf{x}_{b})\right] }{\partial \mathbf{\beta }} \\
&=&\frac{\partial \Lambda (\mathbf{\beta }|\mathbf{x}_{a})}{\partial \mathbf{%
\beta }}-\frac{\partial \Lambda (\mathbf{\beta }|\mathbf{x}_{b})}{\partial 
\mathbf{\beta }}\ .  \notag
\end{eqnarray}%
Substituting this result into equation \ref{VarDelta},%
\begin{eqnarray}
Var\left( G(\mathbf{\beta })\right)  &=&\left[ \frac{\partial \Lambda (%
\mathbf{\beta }|\mathbf{x}_{a})}{\partial \mathbf{\beta }^{\prime }}Var(%
\widehat{\mathbf{\beta }})\frac{\partial \Lambda (\mathbf{\beta }|\mathbf{x}%
_{a})}{\partial \mathbf{\beta }}\right] -\left[ \frac{\partial \Lambda (%
\mathbf{\beta }|\mathbf{x}_{a})}{\partial \mathbf{\beta }^{\prime }}Var(%
\widehat{\mathbf{\beta }})\frac{\partial \Lambda (\mathbf{\beta }|\mathbf{x}%
_{b})}{\partial \mathbf{\beta }}\right]  \\
&&\ \ \ -\left[ \frac{\partial \Lambda (\mathbf{\beta }|\mathbf{x}_{b})}{%
\partial \mathbf{\beta }^{\prime }}Var(\widehat{\mathbf{\beta }})\frac{%
\partial \Lambda (\mathbf{\beta }|\mathbf{x}_{a})}{\partial \mathbf{\beta }}%
\right] +\left[ \frac{\partial \Lambda (\mathbf{\beta }|\mathbf{x}_{b})}{%
\partial \mathbf{\beta }^{\prime }}Var(\widehat{\mathbf{\beta }})\frac{%
\partial \Lambda (\mathbf{\beta }|\mathbf{x}_{b})}{\partial \mathbf{\beta }}%
\right] \ .  \notag
\end{eqnarray}%
We now apply these formula to the models for which \texttt{prvalue} computes
confidence intervals.

\section{Binary Models}

In binary models, $G(\mathbf{\beta })=\Pr (y=1\mid \mathbf{x})=F(\mathbf{x}%
^{\prime }\mathbf{\beta })$ where $F$ is the cdf for the logistic, normal,
or cloglog function. The gradient is%
\begin{equation}
\frac{\partial F(\mathbf{x}^{\prime }\mathbf{\beta })}{\partial \beta _{k}}=%
\frac{\partial F(\mathbf{x}^{\prime }\mathbf{\beta })}{\partial \mathbf{x}%
^{\prime }\mathbf{\beta }}\frac{\partial \mathbf{x}^{\prime }\mathbf{\beta }%
}{\partial \beta _{k}}=f(\mathbf{x}^{\prime }\mathbf{\beta })x_{k}\ ,
\end{equation}%
where $f$ is the pdf corresponding to $F$. For the vector $\mathbf{x}$ it
follows that%
\begin{equation}
\frac{\partial F(\mathbf{x}^{\prime }\mathbf{\beta })}{\partial \mathbf{%
\beta }}=f(\mathbf{x}^{\prime }\mathbf{\beta })\mathbf{x\ .}
\end{equation}%
From equation \ref{VarDelta},%
\begin{eqnarray}
\text{\textit{Var}}\left[ \Pr (y=1\mid \mathbf{x})\right]  &=&f(\mathbf{x}%
^{\prime }\mathbf{\beta })\mathbf{x}^{\prime }Var(\widehat{\mathbf{\beta }})%
\mathbf{x}f(\mathbf{x}^{\prime }\mathbf{\beta })  \notag \\
&=&f(\mathbf{x}^{\prime }\mathbf{\beta })^{2}\mathbf{x}^{\prime }Var(%
\widehat{\mathbf{\beta }})\mathbf{x\ .}
\end{eqnarray}%
The variances of $\Pr (y=0\mid \mathbf{x})$ and $\Pr (y=0\mid \mathbf{x})$
are the equal since%
\begin{equation}
\frac{\partial \left[ 1-F(\mathbf{x}^{\prime }\mathbf{\beta })\right] }{%
\partial \mathbf{\beta }}=-f(\mathbf{x}^{\prime }\mathbf{\beta })\mathbf{x}
\end{equation}%
and%
\begin{equation}
\text{\textit{Var}}\left[ \Pr (y=0\mid \mathbf{x})\right] =\left[ -f(\mathbf{%
x}^{\prime }\mathbf{\beta })\right] ^{2}\mathbf{x}^{\prime }Var(\widehat{%
\mathbf{\beta }})\mathbf{x\ .}
\end{equation}

\section{Ordered Logit and Probit}

Assume that there are $m=1,J$ outcome categories, where%
\begin{equation}
\Pr \left( y=m\mid \mathbf{x}\right) =F\left( \tau _{m}-\mathbf{x}^{\prime }%
\mathbf{\beta }\right) -F\left( \tau _{m-1}-\mathbf{x}^{\prime }\mathbf{%
\beta }\right) \text{ for }j=1,J\ .  \label{ormprob}
\end{equation}%
Since we assume that $\tau _{0}=-\infty $ and $\tau _{J}=\infty $, $F\left(
\tau _{0}-\mathbf{x}^{\prime }\mathbf{\beta }\right) =0$ and $F\left( \tau
_{J}-\mathbf{x}^{\prime }\mathbf{\beta }\right) =1$. To compute the
gradient, 
\begin{eqnarray}
\frac{\partial F\left( \tau _{m}-\mathbf{x}^{\prime }\mathbf{\beta }\right) 
}{\partial \beta _{k}} &=&\frac{\partial F\left( \tau _{m}-\mathbf{x}%
^{\prime }\mathbf{\beta }\right) }{\partial \left( \tau _{m}-\mathbf{x}%
^{\prime }\mathbf{\beta }\right) }\frac{\partial \left( \tau _{m}-\mathbf{x}%
^{\prime }\mathbf{\beta }\right) }{\partial \beta _{k}} \\
&=&f\left( \tau _{m}-\mathbf{x}^{\prime }\mathbf{\beta }\right) \left(
-x_{k}\right) 
\end{eqnarray}%
and%
\begin{equation}
\frac{\partial F\left( \tau _{m}-\mathbf{x}^{\prime }\mathbf{\beta }\right) 
}{\partial \tau _{j}}=\frac{\partial F\left( \tau _{m}-\mathbf{x}^{\prime }%
\mathbf{\beta }\right) }{\partial \left( \tau _{m}-\mathbf{x}^{\prime }%
\mathbf{\beta }\right) }\frac{\partial \left( \tau _{m}-\mathbf{x}^{\prime }%
\mathbf{\beta }\right) }{\partial \tau _{j}}\ .
\end{equation}%
It follows that%
\begin{equation}
\frac{\partial F\left( \tau _{m}-\mathbf{x}^{\prime }\mathbf{\beta }\right) 
}{\partial \tau _{j}}=f\left( \tau _{m}-\mathbf{x}^{\prime }\mathbf{\beta }%
\right) \text{ if }j=m
\end{equation}%
and%
\begin{equation}
\frac{\partial F\left( \tau _{m}-\mathbf{x}^{\prime }\mathbf{\beta }\right) 
}{\partial \tau _{j}}=0\text{ if }j\neq m\ .
\end{equation}%
Using these results with equation \ref{ormprob},%
\begin{eqnarray}
\frac{\partial \Pr \left( y_{i}=m\mid \mathbf{x}_{i}\right) }{\partial \beta
_{k}} &=&\left[ f\left( \tau _{m}-\mathbf{x}^{\prime }\mathbf{\beta }\right)
\left( -x_{k}\right) \right] -\left[ f\left( \tau _{m-1}-\mathbf{x}^{\prime }%
\mathbf{\beta }\right) \left( -x_{k}\right) \right]  \\
&=&-x_{k}f\left( \tau _{m}-\mathbf{x}^{\prime }\mathbf{\beta }\right) -\left[
f\left( \tau _{m-1}-\mathbf{x}^{\prime }\mathbf{\beta }\right) \right]  
\notag
\end{eqnarray}%
and%
\begin{eqnarray}
\frac{\partial \Pr \left( y_{i}=m\mid \mathbf{x}_{i}\right) }{\partial \tau
_{j}} &=&\frac{\partial F\left( \tau _{m}-\mathbf{x}^{\prime }\mathbf{\beta }%
\right) }{\partial \tau _{j}}-\frac{\partial F\left( \tau _{m-1}-\mathbf{x}%
^{\prime }\mathbf{\beta }\right) }{\partial \tau _{j}} \\
&=&f\left( \tau _{m}-\mathbf{x}^{\prime }\mathbf{\beta }\right) \text{ if }%
j=m  \notag \\
&=&-f\left( \tau _{m-1}-\mathbf{x}^{\prime }\mathbf{\beta }\right) \text{ if 
}j=m-1  \notag \\
&=&0\text{ otherwise.}  \notag
\end{eqnarray}

For example, with three categories:%
\begin{eqnarray}
\Pr \left( y=1\mid \mathbf{x}\right) &=&F\left( \tau _{1}-\mathbf{x}^{\prime
}\mathbf{\beta }\right) -0 \\
\Pr \left( y=2\mid \mathbf{x}\right) &=&F\left( \tau _{2}-\mathbf{x}^{\prime
}\mathbf{\beta }\right) -F\left( \tau _{1}-\mathbf{x}^{\prime }\mathbf{\beta 
}\right) \\
\Pr \left( y=3\mid \mathbf{x}\right) &=&1-F\left( \tau _{2}-\mathbf{x}%
^{\prime }\mathbf{\beta }\right) \ ,
\end{eqnarray}%
then%
\begin{eqnarray}
\frac{\partial \Pr \left( y_{i}=1\mid \mathbf{x}_{i}\right) }{\partial \beta
_{k}} &=&-x_{k}\left[ f\left( \tau _{1}-\mathbf{x}^{\prime }\mathbf{\beta }%
\right) \right] \\
\frac{\partial \Pr \left( y_{i}=2\mid \mathbf{x}_{i}\right) }{\partial \beta
_{k}} &=&-x_{k}\left[ f\left( \tau _{2}-\mathbf{x}^{\prime }\mathbf{\beta }%
\right) -f\left( \tau _{1}-\mathbf{x}^{\prime }\mathbf{\beta }\right) \right]
\\
\frac{\partial \Pr \left( y_{i}=3\mid \mathbf{x}_{i}\right) }{\partial \beta
_{k}} &=&-x_{k}\left[ -f\left( \tau _{2}-\mathbf{x}^{\prime }\mathbf{\beta }%
\right) \right] \ .
\end{eqnarray}%
With respect to $\tau $,%
\begin{eqnarray}
\frac{\partial \Pr \left( y_{i}=1\mid \mathbf{x}_{i}\right) }{\partial \tau
_{1}} &=&f\left( \tau _{1}-\mathbf{x}^{\prime }\mathbf{\beta }\right) \\
\frac{\partial \Pr \left( y_{i}=1\mid \mathbf{x}_{i}\right) }{\partial \tau
_{2}} &=&0 \\
\frac{\partial \Pr \left( y_{i}=2\mid \mathbf{x}_{i}\right) }{\partial \tau
_{1}} &=&-f\left( \tau _{1}-\mathbf{x}^{\prime }\mathbf{\beta }\right) \\
\frac{\partial \Pr \left( y_{i}=2\mid \mathbf{x}_{i}\right) }{\partial \tau
_{2}} &=&f\left( \tau _{2}-\mathbf{x}^{\prime }\mathbf{\beta }\right) \\
\frac{\partial \Pr \left( y_{i}=3\mid \mathbf{x}_{i}\right) }{\partial \tau
_{1}} &=&0 \\
\frac{\partial \Pr \left( y_{i}=3\mid \mathbf{x}_{i}\right) }{\partial \tau
_{2}} &=&0\ .
\end{eqnarray}

To implement these procedures in Stata, we create the augmented matrices:%
\begin{equation}
\mathbf{\beta }^{\ast }=\left[ 
\begin{array}{cccc}
\mathbf{\beta }^{\prime } & \tau _{1} & \cdots & \tau _{J-1}%
\end{array}%
\right] ^{\prime }
\end{equation}%
and%
\begin{eqnarray}
\mathbf{x}_{1}^{\ast } &=&\left[ 
\begin{array}{ccccc}
-\mathbf{x}^{\prime } & 1 & 0 & \cdots & 0%
\end{array}%
\right] ^{\prime } \\
\mathbf{x}_{2}^{\ast } &=&\left[ 
\begin{array}{ccccc}
-\mathbf{x}^{\prime } & 0 & 1 & \cdots & 0%
\end{array}%
\right] ^{\prime }  \notag \\
&&\vdots  \notag \\
\mathbf{x}_{J-1}^{\ast } &=&\left[ 
\begin{array}{ccccc}
-\mathbf{x}^{\prime } & 0 & 0 & \cdots & 1%
\end{array}%
\right] ^{\prime }\ ,  \notag
\end{eqnarray}%
\bigskip such that%
\begin{equation}
\mathbf{x}_{j}^{\ast \prime }\mathbf{\beta }^{\ast }=\tau _{j}-\mathbf{%
x\beta \ .}
\end{equation}%
We then create the gradients described above. 
%TCIMACRO{\TeXButton{End Printing (EN)}{\iffalse}}%
%BeginExpansion
\iffalse%
%EndExpansion

we stack the $\tau $'s and $\beta $'s:and augment $\mathbf{x}$ corresponding
to each threshold,With these vectors, $F\left( \tau _{m}-\mathbf{x}^{\prime }%
\mathbf{\beta }\right) =F\left( \mathbf{x}_{m}^{\ast \prime }\mathbf{\beta }%
^{\ast }\right) $ and we can use the same steps as for the binary model,%
\begin{eqnarray*}
\frac{\partial F\left( \mathbf{x}_{m}^{\ast \prime }\mathbf{\beta }^{\ast
}\right) }{\partial \beta _{k}} &=&\frac{\partial F\left( \mathbf{x}%
_{m}^{\ast \prime }\mathbf{\beta }^{\ast }\right) }{\partial \mathbf{x}%
_{m}^{\ast \prime }\mathbf{\beta }^{\ast }}\frac{\partial \mathbf{x}%
_{m}^{\ast \prime }\mathbf{\beta }^{\ast }}{\partial \beta _{k}} \\
&=&\frac{\partial F\left( \tau _{m}-\mathbf{x}^{\prime }\mathbf{\beta }%
\right) }{\partial \left( \tau _{m}-\mathbf{x}^{\prime }\mathbf{\beta }%
\right) }\frac{\partial \left( \tau _{m}-\mathbf{x}^{\prime }\mathbf{\beta }%
\right) }{\partial \beta _{k}} \\
&=&f(\mathbf{x}_{m}^{\ast \prime }\mathbf{\beta }^{\ast })\left(
-x_{k}\right) \\
\frac{\partial F\left( \mathbf{x}_{m}^{\ast \prime }\mathbf{\beta }^{\ast
}\right) }{\partial \tau _{j}} &=&\frac{\partial F\left( \mathbf{x}%
_{m}^{\ast \prime }\mathbf{\beta }^{\ast }\right) }{\partial \mathbf{x}%
_{m}^{\ast \prime }\mathbf{\beta }^{\ast }}\frac{\partial \mathbf{x}%
_{m}^{\ast \prime }\mathbf{\beta }^{\ast }}{\partial \tau _{j}} \\
&=&f(\mathbf{x}_{m}^{\ast \prime }\mathbf{\beta }^{\ast })\text{ if }j=m \\
&=&0\text{ else.}
\end{eqnarray*}%
Applying this to equation \ref{ormprob},%
\begin{equation*}
\frac{\partial \Pr \left( y_{i}=m\mid \mathbf{x}_{i}\right) }{\partial \beta
_{k}}=f\left( \mathbf{x}_{m}^{\ast \prime }\mathbf{\beta }^{\ast }\right)
x_{k}\mathbf{-}f\left( \mathbf{x}_{m-1}^{\ast \prime }\mathbf{\beta }^{\ast
}\right) x_{k}
\end{equation*}%
And%
\begin{equation*}
\frac{\partial \Pr \left( y_{i}=m\mid \mathbf{x}_{i}\right) }{\partial \beta
_{k}}
\end{equation*}%
Note that $f\left( \mathbf{x}_{1}^{\ast \prime }\mathbf{\beta }^{\ast
}\right) =f\left( \mathbf{x}_{J}^{\ast \prime }\mathbf{\beta }^{\ast
}\right) =0.\,\ $For example, with two $x$'s and three $\tau $'s:%
\begin{equation*}
\frac{\partial \Pr \left( y_{i}=1\mid \mathbf{x}_{i}\right) }{\partial 
\mathbf{\beta }^{\ast }}=\left[ 
\begin{array}{c}
f\left( \mathbf{x}_{m}^{\ast \prime }\mathbf{\beta }^{\ast }\right) x_{1} \\ 
f\left( \mathbf{x}_{m}^{\ast \prime }\mathbf{\beta }^{\ast }\right) x_{2} \\ 
f\left( \mathbf{x}_{m}^{\ast \prime }\mathbf{\beta }^{\ast }\right) \\ 
0 \\ 
0%
\end{array}%
\right] -\left[ 
\begin{array}{c}
f\left( \mathbf{x}_{m-1}^{\ast \prime }\mathbf{\beta }^{\ast }\right) x_{1}
\\ 
f\left( \mathbf{x}_{m-1}^{\ast \prime }\mathbf{\beta }^{\ast }\right) x_{2}
\\ 
0 \\ 
f\left( \mathbf{x}_{m-1}^{\ast \prime }\mathbf{\beta }^{\ast }\right) \\ 
0%
\end{array}%
\right]
\end{equation*}%
\begin{equation*}
\frac{\partial F\left( \mathbf{x}_{m}^{\ast \prime }\mathbf{\beta }^{\ast
}\right) }{\partial \mathbf{\beta }^{\ast }}=f(\mathbf{x}_{m}^{\ast \prime }%
\mathbf{\beta }^{\ast })\mathbf{x}_{m}^{\ast }
\end{equation*}%
In order to apply the delta method, we need the gradients of $F$ with
respect to $\mathbf{\beta }$ and the $\tau $'s.%
\begin{eqnarray*}
\frac{\partial F\left( \tau _{m}-\mathbf{x}^{\prime }\mathbf{\beta }\right) 
}{\partial \mathbf{\beta }} &=&\frac{\partial F\left( \tau _{m}-\mathbf{x}%
^{\prime }\mathbf{\beta }\right) }{\partial \left( \tau _{m}-\mathbf{x}%
^{\prime }\mathbf{\beta }\right) }\frac{\partial \left( \tau _{m}-\mathbf{x}%
^{\prime }\mathbf{\beta }\right) }{\partial \mathbf{\beta }} \\
&=&f\left( \tau _{m}-\mathbf{x}^{\prime }\mathbf{\beta }\right) \mathbf{x}
\end{eqnarray*}%
For the thresholds,%
\begin{eqnarray*}
\frac{\partial F\left( \mathbf{x}_{m}^{\ast \prime }\mathbf{\beta }%
_{m}^{\ast }\right) }{\partial \tau _{q}} &=&\frac{\partial F\left( \mathbf{x%
}_{m}^{\ast \prime }\mathbf{\beta }_{m}^{\ast }\right) }{\partial \left( 
\mathbf{x}_{m}^{\ast \prime }\mathbf{\beta }_{m}^{\ast }\right) }\frac{%
\partial \left( \mathbf{x}_{m}^{\ast \prime }\mathbf{\beta }_{m}^{\ast
}\right) }{\partial \tau _{q}} \\
&=&f\left( \tau _{m}-\mathbf{x}^{\prime }\mathbf{\beta }\right) \text{ if }%
m=q \\
&=&0\text{ else.}
\end{eqnarray*}%
\}\} PRINT 
%TCIMACRO{\TeXButton{Restart Printing (RE)}{\fi}}%
%BeginExpansion
\fi%
%EndExpansion

\section{Generalized Ordered Logit\protect\footnote{%
Confidence intervals for the generalized ordered logit model are not
supported in \texttt{prvalue}.}}

The generalized ordered logit model is identical to the ordinal logit model
except that the coefficients associated with $\mathbf{x}$ differ for each
outcome. Since there is an intercept for each outcome, the $\tau $'s are
fixed to zero and $\mathbf{\beta }_{J}=$ $\mathbf{0}$ for identification.
Then,%
\begin{eqnarray}
\Pr \left( y_{i}=1\mid \mathbf{x}_{i}\right) &=&F\left( -\mathbf{x}^{\prime }%
\mathbf{\beta }_{m}\right) \\
\Pr \left( y_{i}=m\mid \mathbf{x}_{i}\right) &=&F\left( -\mathbf{x}^{\prime }%
\mathbf{\beta }_{m}\right) -F\left( -\mathbf{x}^{\prime }\mathbf{\beta }%
_{m-1}\right) \text{ for }m=2,J-1 \\
\Pr \left( y_{i}=J\mid \mathbf{x}_{i}\right) &=&-F\left( -\mathbf{x}^{\prime
}\mathbf{\beta }_{m-1}\right) \ .
\end{eqnarray}%
The gradient with respect to the $\beta $'s is%
\begin{equation}
\frac{\partial F\left( -\mathbf{x}^{\prime }\mathbf{\beta }_{m}\right) }{%
\partial \beta _{m,k}}=f\left( -\mathbf{x}^{\prime }\mathbf{\beta }%
_{m}\right) \left( -x_{k}\right) \ ,
\end{equation}%
while no gradient for thresholds is needed. Then,%
\begin{equation}
\frac{\partial \Pr \left( y_{i}=m\mid \mathbf{x}_{i}\right) }{\partial \beta
_{m,k}}=-x_{k}f\left( -\mathbf{x}^{\prime }\mathbf{\beta }_{m}\right) -\left[
f\left( -\mathbf{x}^{\prime }\mathbf{\beta }_{m-1}\right) \right] \ .
\end{equation}

\section{Multinomial Logit}

Assuming outcomes $1$ through $J,$ 
\begin{equation}
\Pr (y=m|\mathbf{x})=\frac{\exp \left( \mathbf{x\beta }_{m}\right) }{\overset%
{J}{\underset{j=1}{\sum }}\exp \left( \mathbf{x\beta }_{j}\right) }\ ,
\end{equation}%
where without loss of generality we assume that $\mathbf{\beta }_{1}=\mathbf{%
0}$ to identify the model (and accordingly, the derivatives below do not
apply to the partial with respect to $\mathbf{\beta }_{1}$). To simplify
notation, let $\Delta =\sum \exp \left( \mathbf{x\beta }_{j}\right) $. The
derivative of the probability of $m$ with respect to $\mathbf{\beta }_{n}$ is%
\begin{equation}
\frac{\partial \Pr (y=m|\mathbf{x})}{\partial \mathbf{\beta }_{n}}=\frac{%
\partial \exp \left( \mathbf{x\beta }_{m}\right) \Delta ^{-1}}{\partial 
\mathbf{\beta }_{n}}\ .
\end{equation}%
Using the quotient rule, 
\begin{equation}
\frac{\partial \Pr (y=m|\mathbf{x})}{\partial \mathbf{\beta }_{n}}=\left[
\Delta \frac{\partial \exp \left( \mathbf{x\beta }_{m}\right) }{\partial 
\mathbf{\beta }_{n}}-\exp \left( \mathbf{x\beta }_{m}\right) \frac{\partial
\Delta }{\partial \mathbf{\beta }_{n}}\right] \Delta ^{-2}\ .
\end{equation}%
Examining each partial in turn.%
\begin{eqnarray}
\frac{\partial \exp \left( \mathbf{x\beta }_{m}\right) }{\partial \mathbf{%
\beta }_{n}} &=&\frac{\partial \exp \left( \mathbf{x\beta }_{m}\right) }{%
\partial \mathbf{x\beta }_{m}}\frac{\partial \mathbf{x\beta }_{m}}{\partial 
\mathbf{\beta }_{n}} \\
&=&\exp \left( \mathbf{x\beta }_{m}\right) \mathbf{x}\text{ if }m=n  \notag
\\
&=&0\text{ if }m\neq n  \notag
\end{eqnarray}%
and%
\begin{eqnarray}
\frac{\partial \overset{J}{\underset{j=1}{\sum }}\exp \left( \mathbf{x\beta }%
_{j}\right) }{\partial \mathbf{\beta }_{n}} &=&\frac{\overset{J}{\underset{%
j=1}{\sum }}\partial \exp \left( \mathbf{x\beta }_{j}\right) }{\partial 
\mathbf{\beta }_{n}} \\
&=&\exp \left( \mathbf{x\beta }_{n}\right) \mathbf{x\ .}  \notag
\end{eqnarray}%
The last equality follows since the partial of $\exp \left( \mathbf{x\beta }%
_{j}\right) $ with respect to $\mathbf{\beta }_{n}$ is $0$ unless $j=n$.
Combining these results. If $m=n,$%
\begin{eqnarray}
\frac{\partial \Pr (y=m|\mathbf{x})}{\partial \mathbf{\beta }_{m}} &=&\left[
\Delta \exp \left( \mathbf{x\beta }_{m}\right) \mathbf{x}-\exp \left( 
\mathbf{x\beta }_{m}\right) ^{2}\mathbf{x}\right] \Delta ^{-2} \\
&=&\left[ \Delta \exp \left( \mathbf{x\beta }_{m}\right) -\exp \left( 
\mathbf{x\beta }_{m}\right) ^{2}\right] \Delta ^{-2}\mathbf{x}  \notag \\
&=&\left[ \frac{\exp \left( \mathbf{x\beta }_{m}\right) }{\Delta }-\frac{%
\exp \left( \mathbf{x\beta }_{m}\right) }{\Delta }\frac{\exp \left( \mathbf{%
x\beta }_{m}\right) }{\Delta }\right] \mathbf{x}  \notag \\
&=&\left[ \Pr \left( y=m\right) -\Pr \left( y=m\right) \Pr \left( y=m\right) %
\right] \mathbf{x}  \notag \\
&=&\Pr \left( y=m\right) \left[ 1-\Pr \left( y=m\right) \right] \mathbf{x\ .}
\notag
\end{eqnarray}%
For $m\neq n,$ 
\begin{eqnarray}
\frac{\partial \Pr (y=m|\mathbf{x})}{\partial \mathbf{\beta }_{n}} &=&\left[
0-\exp \left( \mathbf{x\beta }_{m}\right) \exp \left( \mathbf{x\beta }%
_{n}\right) \mathbf{x}\right] \Delta ^{-2} \\
&=&-\frac{\exp \left( \mathbf{x\beta }_{m}\right) }{\Delta }\frac{\exp
\left( \mathbf{x\beta }_{n}\right) }{\Delta }\mathbf{x}  \notag \\
&=&\Pr \left( y=m\right) \Pr \left( y=n\right) \mathbf{x\ .}  \notag
\end{eqnarray}%
For example, for two $x$'s and $m=1:$%
\begin{eqnarray}
\frac{\partial \Pr (y=m|\mathbf{x})}{\partial \mathbf{\beta }_{m}} &=&\left[ 
\begin{array}{ccc}
p_{m}\left( 1-p_{m}\right) x_{1} & p_{m}\left( 1-p_{m}\right) x_{2} & 
p_{m}\left( 1-p_{m}\right) 
\end{array}%
\right] ^{\prime } \\
\frac{\partial \Pr (y=m|\mathbf{x})}{\partial \mathbf{\beta }_{n\neq m}} &=&%
\left[ 
\begin{array}{ccc}
-p_{m}p_{n}x_{1} & -p_{m}p_{n}x_{2} & -p_{m}p_{n}%
\end{array}%
\right] ^{\prime }\ .
\end{eqnarray}%
\bigskip 

\section{Poisson and Negative Binomial Regression}

In the Poisson regression model,%
\begin{equation}
\mu _{i}=\exp \left( \mathbf{x}_{i}^{\prime }\mathbf{\beta }\right) \ ,
\end{equation}%
so that%
\begin{eqnarray}
\frac{\partial \mu }{\partial \beta _{k}} &=&\frac{\partial \exp \left( 
\mathbf{x}^{\prime }\mathbf{\beta }\right) }{\partial \beta _{k}} \\
&=&\frac{\partial \exp (\mathbf{x}^{\prime }\mathbf{\beta })}{\partial 
\mathbf{x}^{\prime }\mathbf{\beta }}\frac{\partial \mathbf{x}^{\prime }%
\mathbf{\beta }}{\partial \beta _{k}}  \notag \\
&=&\exp (\mathbf{x}^{\prime }\mathbf{\beta })x_{k}  \notag \\
&=&\mu x_{k}  \notag
\end{eqnarray}%
Using matrices,%
\begin{eqnarray}
\frac{\partial \mu }{\partial \mathbf{\beta }} &=&\frac{\partial \exp \left( 
\mathbf{x}^{\prime }\mathbf{\beta }\right) }{\partial \mathbf{\beta }} \\
&=&\frac{\partial \exp (\mathbf{x}^{\prime }\mathbf{\beta })}{\partial 
\mathbf{x}^{\prime }\mathbf{\beta }}\frac{\partial \mathbf{x}^{\prime }%
\mathbf{\beta }}{\partial \mathbf{\beta }}  \notag \\
&=&\mu \mathbf{x\ .}  \notag
\end{eqnarray}%
The probability of a given count is%
\begin{equation}
\Pr \left( y|\mathbf{x}\right) =\frac{\exp \left( -\mu \right) \mu ^{y}}{y!}%
\ ,
\end{equation}%
so we can compute the gradient as:%
\begin{equation}
\frac{\partial \exp \left( -\mu \right) \mu ^{y}/y!}{\partial \beta _{k}}=%
\frac{1}{y!}\frac{\partial \exp \left( -\mu \right) \mu ^{y}}{\partial \mu }%
\frac{\partial \mu }{\partial \beta _{k}}\ .
\end{equation}%
Since the last term was computed above, we only need to derive%
\begin{eqnarray}
\frac{\partial \exp \left( -\mu \right) \mu ^{y}}{\partial \mu } &=&\exp
\left( -\mu \right) \frac{\partial \mu ^{y}}{\partial \mu }+\mu ^{y}\frac{%
\partial \exp \left( -\mu \right) }{\partial \mu } \\
&=&\exp \left( -\mu \right) y\mu ^{y-1}-\mu ^{y}\exp \left( -\mu \right) \ .
\notag
\end{eqnarray}%
This leads to%
\begin{eqnarray}
\frac{\partial \Pr \left( y|\mathbf{x}\right) }{\partial \beta _{k}} &=&%
\frac{1}{y!}\mu \left[ \exp \left( -\mu \right) y\mu ^{y-1}-\mu ^{y}\exp
\left( -\mu \right) \right] x_{k} \\
&=&\frac{\exp \left( -\mu \right) y\mu ^{y}-\mu ^{y+1}\exp \left( -\mu
\right) }{y!}x_{k}  \notag \\
&=&\frac{y\mu ^{y}-\mu ^{y+1}}{\exp \left( \mu \right) y!}x_{k}\ .  \notag
\end{eqnarray}%
Using matrices,%
\begin{eqnarray}
\frac{\partial \Pr \left( y|\mathbf{x}\right) }{\partial \mathbf{\beta }} &=&%
\frac{\exp \left( -\mu \right) y\mu ^{y}-\mu ^{y+1}\exp \left( -\mu \right) 
}{y!}\mathbf{x} \\
&=&\frac{y\mu ^{y}-\mu ^{y+1}}{\exp \left( \mu \right) y!}\mathbf{x\ .} 
\notag
\end{eqnarray}

The negative binomial model is specified as%
\begin{eqnarray}
\mu  &=&\exp \left( \mathbf{x}^{\prime }\mathbf{\beta }+\varepsilon \right) 
\\
&=&\exp \left( \mathbf{x}^{\prime }\mathbf{\beta }\right) \exp \left(
\varepsilon \right) \ ,  \notag
\end{eqnarray}%
where $\varepsilon $ has a gamma distribution with variance $\alpha $. The
counts have a negative binomial distribution%
\begin{equation}
\Pr \left( y_{i}\mid \mathbf{x}_{i}\right) =\frac{\Gamma \!\left( y_{i}+\nu
\right) }{y_{i}!\,\Gamma \!\left( \nu \right) }\left( \frac{\nu }{\nu +\mu
_{i}}\right) ^{\nu }\left( \frac{\mu _{i}}{\nu +\mu _{i}}\right) ^{y_{i}}\ ,
\end{equation}%
where $\nu =\alpha ^{-1}$. The derivatives of the log-likelihood are given
in Stata Reference, Version 8, page 10. To simplify notation, we define $%
\tau =\ln \alpha ,\ m=1/\alpha ,\ p=1/\left( 1+\alpha \mu \right) ,\ $and $%
\mu =\exp \left( \mathbf{x\beta }\right) $. With $\psi \left( z\right) $
being the digamma function evaluated at $z$,%
\begin{eqnarray}
\frac{\partial \ln \Pr \left( y|\mathbf{x}\right) }{\partial \mathbf{x\beta }%
} &=&p\left( y-\mu \right)  \\
\frac{\partial \ln \Pr \left( y|\mathbf{x}\right) }{\partial \tau } &=&-m%
\left[ \frac{\alpha \left( \mu -y\right) }{1+\alpha \mu }-\ln \left(
1+\alpha \mu \right) +\psi \left( y+m\right) -\psi \left( m\right) \right] \
.
\end{eqnarray}%
Then by the chain rule,%
\begin{eqnarray}
\frac{\partial \ln \Pr \left( y|\mathbf{x}\right) }{\partial \mathbf{x\beta }%
} &=&\frac{\partial \ln \Pr \left( y|\mathbf{x}\right) }{\partial \Pr \left(
y|\mathbf{x}\right) }\frac{\partial \Pr \left( y|\mathbf{x}\right) }{%
\partial \mathbf{x\beta }} \\
&=&\Pr \left( y|\mathbf{x}\right) ^{-1}\frac{\partial \Pr \left( y|\mathbf{x}%
\right) }{\partial \mathbf{x\beta }}\ ,  \notag
\end{eqnarray}%
so that%
\begin{equation}
\frac{\partial \Pr \left( y|\mathbf{x}\right) }{\partial \mathbf{x\beta }}=%
\frac{\partial \ln \Pr \left( y|\mathbf{x}\right) }{\partial \mathbf{x\beta }%
}\Pr \left( y|\mathbf{x}\right) \ .
\end{equation}%
Similarly for $\tau $,%
\begin{equation}
\frac{\partial \Pr \left( y|\mathbf{x}\right) }{\partial \tau }=\frac{%
\partial \ln \Pr \left( y|\mathbf{x}\right) }{\partial \tau }\Pr \left( y|%
\mathbf{x}\right) .
\end{equation}

\section{References}

\begin{description}
\item Agresti, Alan. 2002. Categorical Data Analysis. 2nd Edition. New York:
Wiley.

\item Greene, William H. 2000. Econometric Analysis, 4th Ed. New York:
Prentice Hall.
\end{description}

\medskip \medskip \noindent {\small File: spost\_deltaci-22Aug2005.tex -
22Aug2005}

\end{document}
