## Programming an estimation command in Stata: Allowing for robust or cluster–robust standard errors in a poisson command using Mata

**mypoisson3.ado** adds options for a robust or a cluster–robust estimator of the variance–covariance of the estimator (VCE) to **mypoisson2.ado**, which I discussed in Programming an estimation command in Stata: Handling factor variables in a poisson command using Mata. **mypoisson3.ado** parses the **vce()** option using the techniques I discussed in Programming an estimation command in Stata: Adding robust and cluster–robust VCEs to our Mata based OLS command. Below, I show how to use **optimize()** to compute the robust or cluster–robust VCE.

I only discuss what is new in the code for **mypoisson3.ado**, assuming that you are familiar with **mypoisson2.ado**.

This is the twenty-second 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.

**A poisson command with options for a robust or a cluster–robust VCE**

**mypoisson3** computes Poisson-regression results in Mata. The syntax of the **mypoisson3** command is

**mypoisson3** *depvar* *indepvars* [if] [in] [**,** **vce( robust** |

__cl__uster*clustervar*

**)**

**]**

__nocons__tantwhere *indepvars* can contain factor variables or time-series variables.

In the remainder of this post, I discuss Read more…