# poissonmfx: Marginal effects for a Poisson regression. In mfx: Marginal Effects, Odds Ratios and Incidence Rate Ratios for GLMs

## Description

This function estimates a Poisson regression model and calculates the corresponding marginal effects.

## Usage

 ```1 2``` ```poissonmfx(formula, data, atmean = TRUE, robust = FALSE, clustervar1 = NULL, clustervar2 = NULL, start = NULL, control = list()) ```

## Arguments

 `formula` an object of class “formula” (or one that can be coerced to that class). `data` the data frame containing these data. This argument must be used. `atmean` default marginal effects represent the partial effects for the average observation. If `atmean = FALSE` the function calculates average partial effects. `robust` if `TRUE` the function reports White/robust standard errors. `clustervar1` a character value naming the first cluster on which to adjust the standard errors. `clustervar2` a character value naming the second cluster on which to adjust the standard errors for two-way clustering. `start` starting values for the parameters in the `glm` model. `control` see `glm.control`.

## Details

If both `robust=TRUE` and `!is.null(clustervar1)` the function overrides the `robust` command and computes clustered standard errors.

## Value

 `mfxest` a coefficient matrix with columns containing the estimates, associated standard errors, test statistics and p-values. `fit` the fitted `glm` object. `dcvar` a character vector containing the variable names where the marginal effect refers to the impact of a discrete change on the outcome. For example, a factor variable. `call` the matched call.

`poissonirr`, `glm`

## Examples

 ```1 2 3 4 5 6 7 8 9``` ```# simulate some data set.seed(12345) n = 1000 x = rnorm(n) y = rnegbin(n, mu = exp(1 + 0.5 * x), theta = 0.5) data = data.frame(y,x) poissonmfx(formula=y~x,data=data) ```

### Example output

```Loading required package: sandwich

Attaching package: 'zoo'

The following objects are masked from 'package:base':

as.Date, as.Date.numeric