diff --git a/xtarimau.ado b/xtarimau.ado index dffe684..961dc38 100755 --- a/xtarimau.ado +++ b/xtarimau.ado @@ -1,4 +1,4 @@ -*! version 1.0.2 07oct2022 I I Bolotov +*! version 1.0.3 07oct2022 I I Bolotov program define xtarimau, rclass version 16.0 /* @@ -50,13 +50,17 @@ program define xtarimau, rclass syntax /// [varlist(ts fv)] [if] [in] [iw] [, /// PREestimation(string asis) POSTestimation(string asis) /// - export(string asis) * /// + export(string asis) SDtest * /// ] // adjust and preprocess options loc `tmp' = ustrregexm(`"`options'"', ".*ic\((\w+)\).*", 1) loc ic = cond(ustrregexs(1) == "", "aic", ustrregexs(1)) // get timevar, panelvar and panelval qui tsset, noq + if "`r(panelvar)'" == "" { // examine data + di as err "command requires panel data" + exit 459 + } loc `timevar' = r(timevar) loc `panelvar' = r(panelvar) qui levelsof ``panelvar'', matrow(`panelval') @@ -158,6 +162,24 @@ program define xtarimau, rclass "%5.0f & %5.0f & %6.0f | %12.4f &" matlist `models', title(``title'') rspec(``rspec'') cspec(``cspec'') } + // print tests + if trim(`"`sdtest'"') != "" { + mata: p = (! strpos(st_local("options"), "stat") ? 1..3 : (1,3)), /* + */ (! strpos(st_local("options"), "seas") ? 4..6 : J(1,0,.)) + mata: for(i = 1; i <= cols(p); i++) {; /// + printf("\n{res}" + ("p","d","q","P","D","Q")[p[i]] + /// + " {txt}in {res}" + (p[i] <= 3 ? "arima(#p,#d,#q)" /// + : "sarima(#P,#D,#Q)") /// + ); /// + (void) _stata("sdtesti " + /// + strofreal(rows(st_matrix("`models'"))) + /// + " . " + /// + strofreal(sqrt(variance( /// + st_matrix("`models'")[.,p[i]] /// + ))) + " 0" /// + ); }; + mata: mata drop p i + } // return output cap ret loc ictests ``ictests'' cap ret loc icarima ``icarima'' diff --git a/xtarimau.sthlp b/xtarimau.sthlp index 7b607d3..89e7067 100755 --- a/xtarimau.sthlp +++ b/xtarimau.sthlp @@ -1,5 +1,5 @@ {smcl} -{* *! version 1.0.2 07oct2022}{...} +{* *! version 1.0.3 07oct2022}{...} {vieweralsosee "[TS] arima" "mansection TS arima"}{...} {vieweralsosee "" "--"}{...} {vieweralsosee "[TS] arima postestimation" "help arima postestimation"}{...} @@ -68,6 +68,8 @@ panels with the help of {helpb arimaauto} be ignored{p_end} {synopt:{helpb kpss##options:kpss(...)}}options directly passed to {helpb kpss} except {opth maxl:ag(#)} which will be ignored{p_end} +{synopt:{opt sd:test}}a test for heterogeneity, i.e., whether the standard + deviations of #p, #d, #q, #P, #D, #Q across the panel are {bf:0}{p_end} {syntab:ARIMA-related} {synopt:{opt nocons:tant}}suppress constant term if both @@ -200,6 +202,14 @@ examples. help of the Schwert (1989) formula(s) (the default) or {cmd:xtarimau}'s {opth maxl:ag(#)} option. +{pstd} +{ul:Heterogeneity tests:} + +{pstd} +A set of {helpb sdtesti} commands, called via the {bf:{opt sd:test}} option, +is used to test whether the standard deviations of #p, #d, #q, #P, #D, #Q in +{bf:r(models)} are equal to 0. + {marker options}{...} {title:Options}