Introduction
We now show how to construct a Zero-Truncated Poisson (ZTP) regression model using an option of the Real Statistics Poisson Regression data analysis tool. This tool, in turn, uses Solver to estimate the regression coefficients by maximizing the log-likelihood function described in Zero-Truncated Poisson Regression. The approach used by the data analysis tool is similar to that used for ordinary Poisson regression as described in Poisson Regression using Solver.
Example
Example 1: Fit the data in columns A-D of Figure 1 to a ZTP regression model. Here, los = length of hospital stay.
The coefficients, as calculated by Solver are shown in range G4:G7. As usual, the standard errors are the square roots of the diagonal elements on the covariance matrix, as explained below.
Figure 1 – ZTP regression model
Data Analysis Tool
We used the Real Statistics Poisson Regression data analysis tool to produce the output displayed in Figure 1, along with the output shown in Figures 3 and 4 below.
This is accomplished by pressing Ctrl-m and selecting the Poisson Regression option from the Reg tab. We then fill in the dialog box that appears as shown in Figure 2.
Figure 2 – Poisson Regression dialog box
Note that we need to check the Zero Truncated Poisson Regression option. Also note that since the software will use Solver, the # of Iterations field won’t be used.
In addition to the output shown in Figure 1, the software produces the output shown in Figures 3 and 4.
The output from the ZTP option is similar to that from the standard Poisson regression with a few modifications. We now highlight these differences. The rest of the output is similar to that described in Poisson Regression Analysis Tool. The referenced formulas use worksheet functions described below.
Coefficients
E.g. range H4:L7 in Figure 1 contains the formula =ZTPParam(B2:D21,A2:A21,G4:G7).
Goodness of Fit
Cells O13, O14, and O15 in Figure 3 contain the following formulas:
=ZTPLL0(A2:A21)
=ZTPLL(B2:D21,A2:A21,G4:G7)
=ZTPLL1(A2:A21)
Figure 3 – ZTP Regression (part 2)
Covariance Matrix
Range R4:U7 in Figure 3 contains the following formula:
=ZTPCov(B2:D21,A2:A21,G4:G7)
Residuals
Cells AA4 and AB4 in Figure 4 contain the formulas
=Z4/SQRT(Y4*((1+Y4)*(1-EXP(-Y4))-Y4))*(1-EXP(-Y4))
=SIGN(Z4)*SQRT(2*(IF(X4=0,0,X4*LN(X4/Y4))-Z4))
The values in column AE can be calculated using the array formula
=DIAG(MMULT(MMULT(Y4:Y23*DESIGN(B2:D21), MINVERSE(MMULT(TRANSPOSE(DESIGN(B2:D21)),Y4:Y23* DESIGN(B2:D21)))),TRANSPOSE(DESIGN(B2:D21))))
or by =PoissonHat(B2:D21,Y4:Y23).
Figure 4 – ZTP Regression (part 3)
Predictions
The predicted values, as well as the standard errors and confidence intervals, corresponding to the observed y values are calculated as for ordinary Poisson regression. For more information about this topic see ZTP Regresssion Predictions.
Worksheet Functions
The Real Statistics Resource Pack provides the following worksheet functions in support of ZTP regression based on the data in the n × k X array Rx, the n × 1 Y array Ry, the k+1 × 1 Rc coefficient array and n × 1 frequency (exposure) array Rt. If Rt is omitted it defaults to an array containing all ones.
ZTPParam(Rx, Ry, Rc, Rt, alpha, col1): if col1 = True then this function returns an n+1 × 5 array with the values: coefficient, standard error, z-stat, p-value, lower and upper values for a 1–alpha confidence interval for each of the n+1 coefficients. If col1 = False (default), the coefficients column is not output. If alpha is omitted it defaults to .05.
ZTPLL(Rx, Ry, Rc, Rt): LLfit
ZTPLL0(Ry, Rt): LLmin
ZTPLL1(Ry): LLmax
ZTPCov(Rx, Ry, Rc, Rt): a k+1 × k+1 array containing the coefficient covariance matrix.
Examples Workbook
Click here to download the Excel workbook with the examples described on this webpage.
References
Hilbe, J. M. (2014) Modeling count data. Cambridge University Press
https://assets.cambridge.org/97811070/28333/frontmatter/9781107028333_frontmatter.pdf
UCLA (2024) Zero-Truncated Poisson Regression
https://stats.oarc.ucla.edu/stata/dae/zero-truncated-poisson-regression/