Skip to content

Commit

Permalink
Minor code improvement, help file updated
Browse files Browse the repository at this point in the history
  • Loading branch information
econcz committed Feb 15, 2024
1 parent d7fc49c commit 0be8330
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

24 changes: 10 additions & 14 deletions xtarimau.ado
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
*! version 1.0.1 31jan2022 I I Bolotov

*! version 1.0.2 07oct2022 I I Bolotov
program define xtarimau, rclass
version 13.0
version 16.0
/*
Finds the best [S]ARIMA[X] models in heterogeneous panels with the help
of arimaauto (SSC). The user can run a command or program (= multiple
of (SSC) arimaauto. The user can run a command or program (= multiple
commands at a time) prior to and after the estimation, generating
eventual new variables. The estimates can be exported to a .ster file.
Expand All @@ -14,11 +13,8 @@ program define xtarimau, rclass
tempname timevar panelvar panelval ictests icarima limits models ///
title rspec cspec tmp
tempfile tmpf
// install dependencies, arimaauto
cap which arimaauto
if _rc {
ssc install arimaauto
}
// check for third-party packages from SSC
qui which arimaauto
// replay last result
if replay() {
if _by() {
Expand Down Expand Up @@ -67,7 +63,7 @@ program define xtarimau, rclass
loc `tmp' = r(r)
// check if system limit is not exceeded
qui estimates dir
if (`: word count `r(names)'' + ``tmp'') > 300 & `"`export'"' == "" {
if (`: word count `r(names)'' + ``tmp'') > 300 & trim(`"`export'"') == "" {
di as err ///
"operation will exceed system limit, please add an export() option"
exit 1000
Expand All @@ -81,7 +77,7 @@ program define xtarimau, rclass
forv i = 1/`=rowsof(`panelval') + 1' {
/* restore, add eventual variables to the initial varlist */
restore
if "`r(varlist)'" != "" {
if trim("`r(varlist)'") != "" {
qui merge 1:1 ``panelvar'' ``timevar'' using `tmpf', update nogen
}
/* preserve, reduce the dataset to 1 time series and re-set the data */
Expand All @@ -98,7 +94,7 @@ program define xtarimau, rclass
}
}
/* run preestimation command/program (= multiple commands) */
if `"`preestimation'"' != "" {
if trim(`"`preestimation'"') != "" {
`=cond(! strpos(`"`options'"', "trace"), "qui", "")' ///
`preestimation'
}
Expand All @@ -117,15 +113,15 @@ program define xtarimau, rclass
loc `ictests' `=r(ictests)' // read from r(...)
loc `icarima' `=r(icarima)'
mat `limits' = r(limits)
if `"`export'"' == "" {
if trim(`"`export'"') == "" {
qui estimates store ts_`i'
}
else {
qui estimates save `"`export'"', append
}
cap drop _* // drop ancillary vars
/* run postestimation command/program (= multiple commands) */
if `"`postestimation'"' != "" {
if trim(`"`postestimation'"') != "" {
`=cond(! strpos(`"`options'"', "trace"), "qui", "")' ///
`postestimation'
}
Expand Down
18 changes: 17 additions & 1 deletion xtarimau.sthlp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{smcl}
{* *! version 1.0.1 31jan2022}{...}
{* *! version 1.0.2 07oct2022}{...}
{vieweralsosee "[TS] arima" "mansection TS arima"}{...}
{vieweralsosee "" "--"}{...}
{vieweralsosee "[TS] arima postestimation" "help arima postestimation"}{...}
Expand Down Expand Up @@ -228,6 +228,22 @@ For {helpb arima:arima(...)} see a list of
{cmd:. xtarimau calories, noseas nostep maxm(15) export(test)}
{cmd:. xtarimau calories, noseas post(predict xb)}

{title:Author}

{pstd}
{bf:Ilya Bolotov}
{break}Prague University of Economics and Business
{break}Prague, Czech Republic
{break}{browse "mailto:[email protected]":[email protected]}

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

{p 8 8 2}
Bolotov, I. (2022). XTARIMAU: Stata module to find the best [S]ARIMA[X]
models in heterogeneous panels with the help of arimaauto. Available from
{browse "https://ideas.repec.org/c/boc/bocode/s459048.html"}.

{marker references}{...}
{title:References}

Expand Down

0 comments on commit 0be8330

Please sign in to comment.