## Estimating Time Series Models for Count Outcomes with SAS

In SAS, there is no out-of-box procedure to estimate time series models for count outcomes, which is similar to the one shown here (https://statcompute.wordpress.com/2015/03/31/modeling-count-time-series-with-tscount-package). However, as long as we understand the likelihood function of Poisson distribution, it is straightforward to estimate a time series model with **PROC MODEL** in the ETS module.

Below is a demonstration of how to estimate a Poisson time series model with the identity link function. As shown, the parameter estimates with related inferences are extremely close to the ones estimated with tscount() in R.

data polio; idx + 1; input y @@; datalines; 0 1 0 0 1 3 9 2 3 5 3 5 2 2 0 1 0 1 3 3 2 1 1 5 0 3 1 0 1 4 0 0 1 6 14 1 1 0 0 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 2 0 1 0 1 0 0 1 2 0 0 1 2 0 3 1 1 0 2 0 4 0 2 1 1 1 1 0 1 1 0 2 1 3 1 2 4 0 0 0 1 0 1 0 2 2 4 2 3 3 0 0 2 7 8 2 4 1 1 2 4 0 1 1 1 3 0 0 0 0 1 0 1 1 0 0 0 0 0 1 2 0 2 0 0 0 1 0 1 0 1 0 2 0 0 1 2 0 1 0 0 0 1 2 1 0 1 3 6 ; run; proc model data = polio; parms b0 = 0.5 b1 = 0.1 b2 = 0.1; yhat = b0 + b1 * zlag1(y) + b2 * zlag1(yhat); y = yhat; lk = exp(-yhat) * (yhat ** y) / fact(y); ll = -log(lk); errormodel y ~ general(ll); fit y / fiml converge = 1e-8; run; /* OUTPUT: Nonlinear Liklhood Summary of Residual Errors DF DF Adj Equation Model Error SSE MSE R-Square R-Sq y 3 165 532.6 3.2277 0.0901 0.0791 Nonlinear Liklhood Parameter Estimates Approx Approx Parameter Estimate Std Err t Value Pr > |t| b0 0.606313 0.1680 3.61 0.0004 b1 0.349495 0.0690 5.06 <.0001 b2 0.206877 0.1397 1.48 0.1405 Number of Observations Statistics for System Used 168 Log Likelihood -278.6615 Missing 0 */