*! version 1.0.1 25Mar2026

*! version 1.0.0 06Mar2026

Title

praisk -- Iterated Prais-Winsten regression with AR(k) errors

Syntax

praisk
depvar
[indepvars]
[if] [in]
, lag(#) [options]

Model
* lag(#) set maximum lag order of autocorrelation

noconstant suppress constant term

SE/Robust
robust synonym for vce(robust)

vce(vcetype) vcetype may be ols,
robust, or cluster clustvar

Reporting
level(#) set confidence level; default is level(95)

coeflegend display legend instead of statistics

nolog suppress the iteration log

Convergence
tolerance(#) convergence tolerance; default is tolerance(1e-6)

iterate(#) maximum iterations; default is iterate(250)

* lag() is required.

You must tsset your data before using praisk; see [TS] tsset.

indepvars is optional; if omitted an intercept-only model is fitted.

indepvars may contain factor variables; see fvvarlist.

depvar and indepvars may contain time-series operators; see tsvarlist.

Postestimation syntax

The following predict options are available after praisk:

predict newvar [if] [in] [, statistic]

statistic

xb linear prediction; the default

residuals residuals

ue AR(k) innovation residuals

stdp standard error of the linear prediction

xb and stdp are available both in and out of sample.
residuals and ue are calculated only where the dependent variable
is non-missing. The ue option requires an active tsset time
variable and sets predictions to missing for the first k observations
of each segment, which lack the k lagged residuals required to form the AR innovation.

Description

praisk fits a linear regression model with autoregressive errors AR(k) using the iterated
Prais-Winsten (generalized least squares) estimator. For AR(k>1), praisk follows the methods
described in Vougas (2021). The transformation uses exact initialization of the first k observations
following Galbraith and Galbraith (1974) and Hamilton (1994). AR(k) parameters are estimated by
solving the pooled Yule-Walker cross-product system jointly across all panels and segments, matching
the behavior of official prais.

After estimation, praisk displays a table of residual autocorrelations at lags 1 through k.
The untransformed row shows autocorrelations of the OLS residuals (before AR filtering) and the
transformed row shows autocorrelations of the AR(k) innovation residuals (after filtering).
A successful transformation is indicated by transformed autocorrelations close to zero. For panel
data, autocorrelations are computed using Stata's lag operator, which restricts all pairs to
within-panel consecutive observations, matching the approach used by prais for the
Durbin-Watson statistic.

Typing praisk without arguments replays the last estimation results.

Options

Model

lag(#) specifies the order of the autoregressive process for the errors;
lag() is required and must be >= 1.

noconstant suppresses the constant term from the model.

SE/Robust

robust is a synonym for vce(robust). Cannot be combined with
vce().

vce(vcetype) specifies how the variance-covariance matrix of the
estimator is computed.

vce(ols), the default, uses the standard variance estimator for ordinary
least-squares regression.

vce(robust) specifies to use the Huber/White/sandwich estimator.

vce(cluster clustvar) specifies to use the intragroup
correlation estimator.

Reporting

level(#) specifies the confidence level as a percentage for confidence
intervals. The default is level(95) or as set by set level.

coeflegend; see [R] Estimation options.

nolog suppresses the iteration log that reports the value of rho (for AR(1))
or the maximum modulus of the companion matrix eigenvalues (for AR(k>1)) at each
iteration.

Convergence

tolerance(#) specifies the convergence criterion. Iteration stops when
the maximum absolute change in any AR parameter across successive iterations
is less than #. The default is tolerance(1e-6).

iterate(#) specifies the maximum number of iterations allowed before
an error is returned. The default is iterate(250).

Examples

1) Estimating AR(k) models

Setup

. webuse idle

. tsset t

Perform Prais-Winsten AR(1) regression

. praisk usr idle syslcl sysrem, lag(1)

Perform Prais-Winsten AR(2) and AR(3) estimation

. praisk usr idle syslcl sysrem, lag(2)

. praisk usr idle syslcl sysrem, lag(3)

Robust standard errors

. praisk usr idle syslcl, lag(1) vce(robust)

Replay last results with 99% confidence intervals

. praisk, level(99)

2) Post-estimation

Setup

. webuse idle

. tsset t

. praisk usr idle syslcl sysrem, lag(2)

Obtain fitted values, OLS residuals, and standard errors of prediction

. predict yhat, xb

. predict uhat, residuals

. predict sehat, stdp

Obtain AR innovation residuals

. predict ue, ue

Visual inspection: plot innovations against time. Under correct specification ue should look
like white noise with no visible trend, cycles, or volatility clustering.

. tsline ue

Check autocorrelation function of innovations. All lags should lie within the confidence bands. Significant
spikes suggest the AR order is too low. Compare with ac uhat to see how much autocorrelation the filter removed.

. ac ue

. pac ue

praisk automatically displays a table of autocorrelations at lags 1 through k for both
the untransformed (OLS) residuals and the AR innovation residuals. A successful transformation is
indicated by autocorrelations close to zero in the transformed row. For single time series data,
wntestq can be used for a formal white noise test on the innovation residuals.

3) AR order selection workflow

Setup

. webuse idle

. tsset t

Fit AR(1); the autocorrelation table shows whether lag-1 serial correlation has been removed

. praisk usr idle syslcl, lag(1)

. predict uhat1, residuals

. predict ue1, ue

. ac uhat1

. ac ue1

Fit AR(2); check whether lag-1 and lag-2 serial correlation have been removed

. praisk usr idle syslcl, lag(2)

. predict uhat2, residuals

. predict ue2, ue

. ac uhat2

. ac ue2

Stop increasing the AR order when the transformed autocorrelations are negligible and autocorrelation
function indicates that there are no more significant lags. For formal testing, actest can be applied
(downloadable from SSC) to the saved innovation residuals.

4) Normality and heteroskedasticity diagnostics

Setup

. webuse idle

. tsset t

. praisk usr idle syslcl, lag(2)

. predict ue, ue

Test normality of innovations

. swilk ue

. sktest ue

. qnorm ue

. histogram ue, normal

Departures from normality affect the validity of reported t and F statistics.
Outliers in ue that are not prominent in uhat may indicate
observations where the AR filter is amplifying noise.

Check for heteroskedasticity in the innovations

. predict yhat, xb

. scatter ue yhat

If heteroskedasticity is found, re-estimate with vce(robust) or
vce(cluster clustvar). Note: use the OLS residuals
uhat (not ue) to decide whether robust standard errors
are needed, since vce(robust) is applied to the GLS-transformed
data, not to the AR innovations.

Stored results

praisk stores the following in e():

Scalars

e(N) number of observations

e(rank) rank of variance-covariance matrix

e(df_m) model degrees of freedom

e(df_r) residual degrees of freedom

e(F) F statistic (ANOVA F for OLS; Wald F for robust/cluster)

e(r2) R-squared (computed on GLS-transformed data)

e(r2_a) adjusted R-squared

e(rmse) root mean squared error

e(mss) model sum of squares (transformed)

e(rss) residual sum of squares (transformed)

e(ll) exact log likelihood

e(level) confidence level

e(iterations) number of iterations to convergence

e(tolerance) convergence tolerance used

e(ngaps) number of gaps (panel changes + time gaps)

e(N_clust) number of clusters (if vce(cluster))

e(ac_ols1), e(ac_ols2), ... autocorrelation of untransformed residuals at lag k

e(ac_ue1), e(ac_ue2), ... autocorrelation of AR innovation residuals at lag k

Macros

e(cmd) praisk

e(cmdline) command as typed

e(title) title in estimation output

e(depvar) name of dependent variable

e(timevar) name of time variable

e(panelvar) name of panel variable (if panel data)

e(vce) vcetype specified in vce()

e(vcetype) title used to label standard errors

e(clustvar) name of cluster variable (if vce(cluster))

e(noconstant) noconstant, if specified

Matrices

e(b) coefficient vector

e(V) variance-covariance matrix of the estimator

e(rho) AR parameter estimates (1 x k)

e(serho) standard errors of AR parameter estimates (1 x k)

Functions

e(sample) marks estimation sample

In addition to the above, the following is stored in r():

Matrices

r(table) matrix containing the coefficients with their standard errors, test statistics, p-values, and confidence intervals

Note that results stored in r() are updated when the command is replayed and will be replaced when any r-class command is run after the estimation command.

References

Galbraith, R. F., and J. I. Galbraith. 1974. On the inverses of some patterned matrices arising
in the theory of stationary time series. Journal of Applied Probability 11(1): 63–71.

Hamilton, J. D. 1994. Time Series Analysis. Princeton University Press.

Linden, A. 2026. Adjustment for autocorrelation in multiple-group (controlled) interrupted time series
analysis and its effect on power: A simulation study of the Newey-West and Prais-Winsten methods.
Preprint. Research Square. https://doi.org/10.21203/rs.3.rs-8865851/v1

Linden, A. 2026. Multiple-group (controlled) interrupted time series analysis with higher-order autoregressive errors:
A simulation study comparing Newey–West and Prais–Winsten methods.
Preprint. arXiv:2603.24814 https://arxiv.org/abs/2603.24814

Vougas, D. V. 2021. Prais-Winsten algorithm for regression with second or
higher order autoregressive errors. Econometrics 9(3): 32.

Author

Ariel Linden

Linden Consulting Group, LLC

alinden@lindenconsulting.org

Acknowledgements

I am grateful to Dimitrios V. Vougas for graciously providing the MATLAB code that served as the
basis for the implementation in praisk.

Citation of praisk

praisk is not an official Stata command. It is a free contribution
to the research community, like a paper. Please cite it as such:

Linden, Ariel. 2026. PRAISK: Stata module for computing iterated Prais-Winsten regression with AR(k) errors.
Statistical Software Components s459648, Boston College Department of Economics.

Also see

Manual: [TS] prais

Online: prais, regress, newey, arima, ac, actest (if installed)