## Programming an estimation command in Stata: Adding analytical derivatives to a poisson command using Mata

\(\newcommand{\xb}{{\bf x}}

\newcommand{\betab}{\boldsymbol{\beta}}\)Using analytically computed derivatives can greatly reduce the time required to solve a nonlinear estimation problem. I show how to use analytically computed derivatives with **optimize()**, and I discuss **mypoisson4.ado**, which uses these analytically computed derivatives. Only a few lines of **mypoisson4.ado** differ from the code for **mypoisson3.ado**, which I discussed in Programming an estimation command in Stata: Allowing for robust or cluster–robust standard errors in a poisson command using Mata.

This is the twenty-third post in the series **Programming an estimation command in Stata**. I recommend that you start at the beginning. See Programming an estimation command in Stata: A map to posted entries for a map to all the posts in this series.

**Analytically computed derivatives for Poisson**

The contribution of the *i*(th) observation to the log-likelihood function for the Poisson maximum-likelihood estimator is Read more…