Skip to contents

R arm of the Python modules morie.fn.scdisp, scnblrt, scpboot and scpflx. Scdisp: Cameron-Trivedi regression test of equidispersion after a Poisson GLM (as AER::dispersiontest; trafo = NULL for \(Var = (1 + \alpha)\mu\), trafo = 2 for \(Var = \mu + \alpha\mu^2\)), one-sided. Scnblrt: likelihood ratio of NB against Poisson with the boundary (50:50 chi-bar-square) p-value. Scpboot: parametric bootstrap of the spatial-lag Poisson rho (SarPoisson, refined by Newton steps on the analytic profile score), Poisson draws by inversion of Philox uniforms, type-7 percentile interval. Scpflx: spatial-lag Poisson with unit fixed effects on a panel stacked by period, block-diagonal weights.

Usage

Scdisp(y, X, trafo = NULL)

Scnblrt(ll_nb, ll_pois, df = 1)

Scpboot(y, X, W, B = 9, seed = 0, level = 0.95)

Scpflx(y, X, W, unit_id)

Arguments

y

Counts.

X

Design matrix (with intercept for Scdisp and Scpboot; time-varying regressors for Scpflx).

trafo

NULL or 2.

ll_nb, ll_pois

Log-likelihoods of the NB and the Poisson fit.

df

Number of dispersion parameters.

W

Spatial weights matrix.

B

Bootstrap replicates.

seed

Philox seed.

level

Confidence level.

unit_id

Unit label of every observation.

Value

A list whose statistic is the headline value.

References

Cameron, A. C. and Trivedi, P. K. (1990). Regression-based tests for overdispersion in the Poisson model. Journal of Econometrics 46, 347-364.

Self, S. G. and Liang, K.-Y. (1987). Asymptotic properties of maximum likelihood estimators and likelihood ratio tests under nonstandard conditions. Journal of the American Statistical Association 82, 605-610.

Lambert, D. M., Brown, J. P. and Florax, R. J. G. M. (2010). A two-step estimator for a spatial lag model of counts. Regional Science and Urban Economics 40, 241-252.

Examples

X <- cbind(1, c(0.1, 0.4, 0.5, 0.9, 0.3, 0.7, 0.2, 0.8))
Scdisp(c(0, 3, 1, 9, 0, 6, 2, 1), X)$statistic
#> [1] 0.7182705
Scnblrt(-40, -42)$p_value
#> [1] 0.02275013