*! version 1.0.0 22Jul2026

Title

xtbetark -- Beta regression with AR(k) errors for
proportion/rate outcomes, by joint conditional maximum likelihood, with
panel-corrected standard errors

Syntax

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

Model
* lag(#) set the order of the AR(k) process for the mean equation

scale(varlist) covariates for the precision (scale) equation; default is constant only

noconstant suppress constant term from the mean equation

SE/VCE
vce(vcetype) pcse (the default), dk, or oim

nmk normalize standard errors by N-k instead of N

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

coeflegend display legend instead of statistics

nolog suppress the iteration log

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

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

from(matrix) user-supplied starting values, in place of the default static betareg fit

* lag(#) is required.

Your data must be xtset with both a panel and a time variable before
using xtbetark; see xtset.

depvar must be strictly greater than 0 and less than 1.

indepvars is optional; if omitted, an intercept-only mean equation is fitted.

Factor variables and time-series operators are allowed in depvar, indepvars,
and scale(); see fvvarlist and tsvarlist.

Typing xtbetark without arguments replays the last estimation results.

Postestimation syntax

The following predict options are available after xtbetark:

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

statistic

cmean conditional (AR-adjusted, one-step-ahead) mean of depvar; the default

cvariance conditional (AR-adjusted) variance of depvar

xb linear prediction in the mean equation, without the AR adjustment

xbscale linear prediction in the scale equation

xb and xbscale are available both in and out of sample. cmean and
cvariance require lagged values of depvar and are therefore computed only
where the full AR(k) history is available within a contiguous panel-time
segment; the AR(k) recursion is restarted at every panel change or time gap,
exactly as in estimation.

Description

xtbetark extends betark (if installed) to panel data.
The AR(k) component -- the mean equation's autoregressive adjustment, jointly
estimated with the scale equation and AR coefficients via the same recursive
conditional likelihood -- works exactly as in betark. xtbetark adds
the variance-covariance estimator. A panel-appropriate sandwich is applied
on top of the AR(k)-adjusted likelihood, so the correction targets
only the cross-panel dependence the AR(k) term does not already handle.
Two such corrections are available via vce() -- pcse (Beck and Katz [1995])
and dk ( Driscoll and Kraay [1998])-- differing in whether they include a time-lag smoothing kernel;
a third, oim, applies no panel correction at all and provides results identical
to those produced by betark.

Options

Model

lag(#) specifies the order of the AR(k) process in the mean equation and must
be a positive integer; lag() is required.

scale(varlist) specifies covariates for the precision (scale) equation, on the
log scale. If omitted, the scale equation is constant-only (a single estimated
precision parameter phi, as in the default betareg specification).

noconstant suppresses the constant term from the mean equation. The scale
equation always includes a constant in the current version. The mean equation
uses a logit link and the scale equation a log link; no other links are
currently implemented, so these are not user-settable options.

SE/VCE

vce(vcetype) selects the variance-covariance estimator. All three
options share identical point estimates within a call; only the
reported standard errors differ.

vce(pcse), the default, generalizes the panel-corrected standard
errors of Beck and Katz (1995) -- the same
correction xtpraisk (if installed) applies -- from a
single-equation linear model to xtbetark's three equations (mean,
scale, each AR lag). For every pair of equations, a cross-panel
covariance is estimated from that pair's equation-level likelihood
scores and combined with the corresponding design cross-products; the
blocks are assembled into the full sandwich. Like the original PCSE,
this has no time-lag kernel -- only a contemporaneous cross-panel
term. That is a deliberate match to xtbetark: because the AR(k)
likelihood already removes serial dependence parametrically, there
should be little serial correlation left in the score for a time-lag
correction to usefully explain.

vce(dk) applies a Driscoll and Kraay (1998)-style sandwich to the
same equation-level scores, following Hoechle (2007)'s
xtscc construction. Unlike vce(pcse), this
includes a Bartlett-kernel time-lag correction, with the bandwidth fixed
internally to lag(#), the same AR order fitted in the mean equation
-- not the Newey-West (1994) automatic rule, floor(4*(T/100)^(2/9)),
that xtscc (if installed) uses by default for OLS residuals
with unmodeled serial dependence. Because xtbetark's AR(k)
likelihood already removes serial dependence parametrically, any
residual correlation left in the score should plausibly extend no
further than the fitted AR order, not scale up with the number of time
periods the way it would for a model with no serial-dependence
correction at all. Provided mainly for
comparison; because vce(dk)'s kernel is designed to correct for
serial dependence that xtbetark's AR(k) likelihood should have
already removed, it is more prone than vce(pcse) to the
finite-sample anticonservative bias documented for Newey-West-type HAC
estimators when little serial correlation remains to explain.

vce(oim) is betark's original observed-information
covariance, with no cross-panel correction at all. It
is numerically identical to running betark on the same
xtset data.

nmk normalizes standard errors by N-k instead of N when applied to
vce(pcse), where k is the total number of estimated
coefficients across all equations. This mirrors xtpraisk's nmk
option, and like it, is off by default. Ignored for vce(dk) and
vce(oim).

Reporting

level(#) specifies the confidence level as a percentage. Default is
level(95).

coeflegend; see [R] Estimation options.

nolog suppresses the iteration log.

Convergence

tolerance(#) specifies the parameter- and value-change convergence criterion.
Default is tolerance(1e-6).

iterate(#) specifies the maximum number of iterations. Default is
iterate(1500), matching betareg's default.

from(matrix) supplies user starting values in place of the default, which is
a static betareg fit (rho = 0) on the same mean and scale specification.

Examples

Set-up

. use xtbetark_example.dta

. xtset id t

Fit an AR(1) model with the default panel-corrected (PCSE) SEs

. xtbetark y_ar1 _x _x_t, lag(1)

Compare against the Driscoll-Kraay-style alternative

. xtbetark y_ar1 _x _x_t, lag(1) vce(dk)

Compare against the uncorrected VCE (numerically identical to betark)

. xtbetark y_ar1 _x _x_t, lag(1) vce(oim)

. betark y_ar1 _x _x_t, lag(1)

Covariates in the scale (precision) equation

. xtbetark y_ar2 _x _x_t, lag(2) scale(t)

Postestimation -- AR-adjusted conditional mean and variance

. xtbetark y_ar2 _x _x_t, lag(2)

. predict mu_hat, cmean

. predict var_hat, cvariance

. tsline y_ar2 mu_hat if id==1, xline(150) legend(off)

Stored results

xtbetark stores the following in e():

Scalars

e(N) number of observations (excludes the first k observations of
each panel-time segment, used to initialize the AR recursion but not contributing to
the likelihood)

e(df_m) mean-equation model degrees of freedom (excludes scale and AR
parameters)

e(chi2) Wald chi-squared statistic for the mean equation's non-constant
coefficients

e(p) p-value for Wald chi-squared

e(ll) joint conditional log likelihood at the final estimates

e(p_lag) order of the AR process fitted

e(iterations) number of iterations to convergence

e(converged) 1 if the optimizer reported convergence, 0 otherwise

e(ngaps) number of gaps in sample (includes panel changes); the AR
recursion is restarted at each

e(tolerance) convergence tolerance used

e(N_g) number of panels

e(g_min) smallest panel size

e(g_avg) average panel size

e(g_max) largest panel size

e(dklag) Bartlett kernel bandwidth used, always equal to lag(#) (only if vce(dk)); computed internally, not user-settable

e(nmk) 1 if the N-k normalization was applied (only if
vce(pcse))

Macros

e(cmd) xtbetark

e(cmdline) command as typed

e(title) title in estimation output

e(depvar) name of dependent variable

e(timevar) / e(tvar) name of time variable

e(panelvar) / e(ivar) name of panel variable

e(link) link function used for the mean equation

e(linkt) title used to label the mean-equation link in the output header

e(slink) link function used for the scale equation

e(slinkt) title used to label the scale-equation link in the output header

e(noconstant) noconstant, if specified

e(vce) pcse, dk, or oim

e(vcetype) label describing the VCE, shown in the output header

e(predict) xtbetark_p

Matrices

e(b) coefficient vector, with three equation blocks: the mean equation
(named after depvar), scale, and ar (rho_1,...,rho_k)

e(V) variance-covariance matrix, per vce()

Functions

e(sample) marks estimation sample

References

Beck, N. L., and J. N. Katz. 1995. What to do (and not to do) with
time-series cross-section data. American Political Science Review
89: 634-647.

Driscoll, J. C., and A. C. Kraay. 1998. Consistent covariance matrix
estimation with spatially dependent panel data. Review of Economics
and Statistics 80(4): 549-560.

Ferrari, S., and F. Cribari-Neto. 2004. Beta regression for modelling rates and
proportions. Journal of Applied Statistics 31(7): 799-815.

Ferreira, G., J. I. Figueroa-Zuniga, and M. de Castro. 2015. Partially linear beta
regression model with autoregressive errors. TEST 24(4): 752-775.

Hoechle, D. 2007. Robust standard errors for panel regressions with
cross-sectional dependence. Stata Journal 7(3): 281-312.

Linden, A. 2026. Beta regression with autoregressive errors for interrupted time
series analysis of proportion and rate outcomes: A simulation study.
Preprint. https://arxiv.org/abs/2607.07914

Linden, A. 2026. Extending beta regression to panel data
with higher-order autoregressive errors: A Simulation Study.
Preprint. arXiv.

Linden, A. 2026. Extending Prais-Winsten regression to panel data
with higher-order autoregressive errors: A simulation study.
https://arxiv.org/html/2606.12596v1

Newey, W. K., and K. D. West. 1994. Automatic lag selection in
covariance matrix estimation. Review of Economic Studies 61(4): 631-653.

Rocha, A. V., and F. Cribari-Neto. 2009. Beta autoregressive moving average models.
TEST 18(3): 529-545.

Author

Ariel Linden

Linden Consulting Group, LLC

alinden@lindenconsulting.org

Citation of xtbetark

xtbetark 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. XTBETARK: Stata module for computing beta regression with AR(k) errors for
proportion/rate outcomes, by joint conditional maximum likelihood, with panel-corrected standard errors.
Statistical Software Components SXXXXXX, Boston College Department of Economics.

Also see

Online: betark (if installed), praisk (if installed),
xtpraisk (if installed), poissark (if installed),
betareg, xtpcse