*! version 1.0.1 20feb2024

Title

xtrevu -- Reverse the order of values of time series and panel data
variables and/or estimate a command on them and save prediction, residuals, etc.

Syntax

xtrevu
[varlist]
[if] [in]
[, options]
: stata_cmd

Value order
replace replace varlist

prefix(strings:string) generate new variables from
varlist with the provided prefix

Postestimation
type(strings:string) new variable
data type for predict

xb(strings:string) existing or new variable for predict
[type] newvar,
xb

residuals(strings:string) existing or new variable for
predict [type] newvar,
residuals

stdp(strings:string) existing or new variable for
predict [type] newvar,
stdp

force replace existing variables, specified in xb(),
residuals(), or stdp()

Wrapper
preestimation(strings:string) any command or program, defined
with program define, including a series of commands, which will
run prior to the model estimation

postestimation(strings:string) any command or program, defined
with program define, including a series of commands, which will
run after the model estimation

The user must tsset or xtset the data before using xtrevu;
see [TS] tsset and [XT] xtset.

Description

xtrevu reverses the order of values of time series and/or panel data
variables, either by substituting the original values, see replace, or by
creating new variables with a prefixed identifier, see prefix(). If a
"colon" command is provided, see : stata_cmd and examples, an estimation
procedure is executed on the inverted variables. The results of this estimation,
including predictions, xb(), residuals residuals(), and others,
stdp(), are stored as either existing variables or new ones. Additionally,
a comprehensive post-estimation command can be executed, see
preestimation() and postestimation().

Examples

time series (an AP(1) model!):
. sysuse gnp96.dta, clear
. xtrevu gnp96, prefix(rv_): arima rv_gnp96, arima(1,0,0)

panel data:
. sysuse xtline1.dta, clear
. xtrevu calories, prefix(rv_)
. xtrevu calories: xtreg calories day

Author

Ilya Bolotov

Prague University of Economics and Business

Prague, Czech Republic

ilya.bolotov@vse.cz

Thanks for citing this software and my works on the topic:

Bolotov, I. (2024). 'XTREVU': module to reverse the order of values of time
series and panel data variables. Available from
https://ideas.repec.org/c/boc/bocode/s459296.html.