Robust estimators for count data I am looking for robust estimators for parameters of a processes producing count data:
$$
(n_1,...,n_K), n_i\in\mathbb{N}
$$
that is the underlying distribution is something like Poisson or Negative binomial, but possibly contaminated - with some samples exhibiting an excessively low or excessively high counts.
I have in mind something like an estimator along the lines of truncated mean or Winsorized mean (that is discarding some data), or an M-estimator along the lines of Huber loss giving lower weight to outliers.
Remarks

*

*Thread Robust estimation of Poisson distribution discusses solving a similar problem in R (robust package description). I am however more interested in the underlying math (which I intend to implement myself in Python.)

*Other R packages: poissonMT, robeth, robustbase

For a Poisson distribution $f_\theta(y)=\frac{e^{_\theta}\theta^y}{y!},y\in\mathbb{N}_0$, an M-estimator is given by
$$
\sum_{i=1}^n\psi(y_i, \hat{\theta})=0,
$$
where
$$
\psi_{k,a}(y_i,\theta)=\frac{y_i-\theta-a\sqrt{\theta}}{\sqrt{\theta}}
\min\left[1,\frac{k\sqrt{\theta}}{y_i-\theta-a\sqrt{\theta}}\right].
$$
This estimator is equivalent to the one based on Huber loss in case of estimation of location for a Normal distribution.
Parameter $a$ is necessary to correct for bias (the problem nicely discussed by @AdamO), and satisfies
$$
E\psi_{k,a}(Y,\theta)=0
$$
In practice, the $a$ is calculated using the sample average and the current estimate of $\theta$, in the course of iteratively reweighted least squares procedure (IRWLS), commonly used for M-estimators.
This estimator is implemented in the R packages cited in the OP. The particular form of the estimator is due to Cadigan and Chen, Properties of robust m-estimators for Poisson and negative binomial data. A clear presentation, accessible to non-statisticians, can be found in thesis Robust modelling of count data by Elsaied, which also proposes a similar generalization of Tukey's M-estimator.
