Am 29.06.2015 um 14:03 schrieb Sven Schreiber:
> Am 23.06.2015 um 17:06 schrieb Allin Cottrell:
>
>
>>
>> For now I've committed a minimal change to ADF output (without prejudice
>> to more radical change later): I've moved the supplementary info
>> (rho-hat for the residual and the joint significance of lagged
>> differences, if any) below the main output, namely the estimate of (a -
>> 1), the tau statistic and its p-value.
>
> Thanks Allin, I still have the more radical formatting on my to-do-list.
> I guess it'll take some time to become acquainted with the way printout
> is set up in the source, so I cannot do this right away, but will try.
>
Ok here's a diff file for adf_kpss.c -- I spent a ridiculous amount of
time ending up not too far from the previous status quo, but well. Guess
I became acquainted a little with the C source style along the way.
(If again the encoding is messed up I have no idea why. I re-checked and
every tool seems to be set to utf-8 here, including thunderbird AFAICS.)
I'm also attaching the actual output of how it looks with this change.
Better double-check the changes, because while I did test, I also
managed to produce a few crashes through typos and syntax mistakes...
thanks,
sven
Index: adf_kpss.c
===================================================================
RCS file: /cvsroot/gretl/gretl/lib/src/adf_kpss.c,v
retrieving revision 1.128
diff -u -w -r1.128 adf_kpss.c
--- adf_kpss.c 23 Jun 2015 15:03:53 -0000 1.128
+++ adf_kpss.c 30 Jun 2015 20:15:59 -0000
@@ -488,7 +488,8 @@
if (!na(F)) {
pprintf(prn, " %s: F(%d, %d) = %.3f [%.4f]\n",
- _("lagged differences"), order, pmod->dfd, F,
+ _("lagged diff exclusion test"),
+ order, pmod->dfd, F,
snedecor_cdf_comp(order, pmod->dfd, F));
}
@@ -527,26 +528,29 @@
if (p <= 0 && pmax == 0) {
if (opt & OPT_G) {
- pprintf(prn, _("Dickey-Fuller (GLS) test for %s\n"), s);
+ pprintf(prn, _("%s: Dickey-Fuller (GLS) test\n"), s);
} else {
- pprintf(prn, _("Dickey-Fuller test for %s\n"), s);
+ pprintf(prn, _("%s: Dickey-Fuller test\n"), s);
}
} else {
if (opt & OPT_G) {
- pprintf(prn, _("Augmented Dickey-Fuller (GLS) test for %s\n"), s);
+ pprintf(prn, _("%s: Augmented Dickey-Fuller (GLS) test\n"), s);
} else {
- pprintf(prn, _("Augmented Dickey-Fuller test for %s\n"), s);
+ pprintf(prn, _("%s: Augmented Dickey-Fuller test\n"), s);
}
- if (p == 1) {
- pprintf(prn, _("including one lag of (1-L)%s"), s);
+ if (p <= 0) {
+ pputs(prn, _("without lagged differences"));
+ } else if (p == 1) {
+ pprintf(prn, _("including one lag of diff(%s)"), s);
} else {
- pprintf(prn, _("including %d lags of (1-L)%s"), p, s);
+ pprintf(prn, _("including %d lags of diff(%s)"), p, s);
}
+
if (pmax >= p) {
const char *critstr = test_down_string(test_down, opt);
pputc(prn, '\n');
- pprintf(prn, _("(max was %d, criterion %s)"),
+ pprintf(prn, _("(max lag was %d, criterion %s)"),
pmax, critstr);
}
pputc(prn, '\n');
@@ -556,10 +560,10 @@
static const char *DF_model_string (int i)
{
const char *models[] = {
- "(1-L)y = (a-1)*y(-1) + e",
- "(1-L)y = b0 + (a-1)*y(-1) + e",
- "(1-L)y = b0 + b1*t + (a-1)*y(-1) + e",
- "(1-L)y = b0 + b1*t + b2*t^2 + (a-1)*y(-1) + e"
+ "diff(y) = (a-1)*y(-1) + res",
+ "diff(y) = cnst + (a-1)*y(-1) + res",
+ "diff(y) = cnst + b1*t + (a-1)*y(-1) + res",
+ "diff(y) = cnst + b1*t + b2*t^2 + (a-1)*y(-1) + res"
};
if (i >= 0 && i < 4) {
@@ -572,10 +576,10 @@
static const char *ADF_model_string (int i)
{
const char *models[] = {
- "(1-L)y = (a-1)*y(-1) + ... + e",
- "(1-L)y = b0 + (a-1)*y(-1) + ... + e",
- "(1-L)y = b0 + b1*t + (a-1)*y(-1) + ... + e",
- "(1-L)y = b0 + b1*t + b2*t^2 + (a-1)*y(-1) + ... + e"
+ "diff(y) = (a-1)*y(-1) + ... + res",
+ "diff(y) = cnst + (a-1)*y(-1) + ... + res",
+ "diff(y) = cnst + b1*t + (a-1)*y(-1) + ... + res",
+ "diff(y) = cnst + b1*t + b2*t^2 + (a-1)*y(-1) + ... + res"
};
if (i >= 0 && i < 4) {
@@ -588,8 +592,8 @@
static const char *DF_test_string (int i)
{
const char *tests[] = {
- N_("test without constant"),
- N_("test with constant"),
+ N_("without constant"),
+ N_("with constant"),
N_("with constant and trend"),
N_("with constant and quadratic trend")
};
@@ -608,7 +612,7 @@
const char *urcstrs[] = {
"nc", "c", "ct", "ctt"
};
- char pvstr[48];
+ char pvstr[80]; // was 48
char taustr[16];
int i;
@@ -622,36 +626,41 @@
} else {
int asy = (ainfo->order > 0 || (opt & OPT_G));
- sprintf(pvstr, "%s %.4g",
+ sprintf(pvstr, "%-22s = %7.4f\n %-.34s",
(asy)? _("asymptotic p-value") : _("p-value"),
- ainfo->pval);
+ ainfo->pval,
+ "---------------------------------------");
}
if (*blurb_done == 0) {
DF_header(ainfo->vname, ainfo->order, ainfo->kmax,
test_down, opt, prn);
- pprintf(prn, _("sample size %d\n"), ainfo->T);
+ pprintf(prn, _("sample size: %d\n"), ainfo->T);
if (ainfo->flags & ADF_PANEL) {
pputc(prn, '\n');
} else {
- pputs(prn, _("unit-root null hypothesis: a = 1"));
- pputs(prn, "\n\n");
+ pputs(prn, _("(H0: unit-root, a = 1)\n"));
+ pputs(prn, " \n");
}
*blurb_done = 1;
}
+ // only if no Engle-Granger test
+ if ( !(ainfo->flags & ADF_EG_RESIDS) ) {
+ pprintf(prn, "%s", _(DF_test_string(i)));
+ if (ainfo->nseas > 0 && i > 0) {
+ pputs(prn, _(" plus seasonal dummies"));
+ }
+ pputs(prn, ":\n");
+ }
+
if (ainfo->flags & ADF_EG_RESIDS) {
/* last step of Engle-Granger test */
pprintf(prn, " %s: %s\n", _("model"),
(ainfo->order > 0)? ADF_model_string(0) :
DF_model_string(0));
} else {
- pprintf(prn, " %s ", _(DF_test_string(i)));
- if (ainfo->nseas > 0 && i > 0) {
- pputs(prn, _("plus seasonal dummies"));
- }
- pputc(prn, '\n');
- pprintf(prn, " %s: %s\n", _("model"),
+ pprintf(prn, "( %s )\n",
(ainfo->order > 0)? ADF_model_string(i) :
DF_model_string(i));
}
@@ -662,10 +671,11 @@
sprintf(taustr, "tau_%s(%d)", urcstrs[i], ainfo->niv);
}
- pprintf(prn, " %s: %g\n"
- " %s: %s = %g\n",
- _("estimated value of (a - 1)"), ainfo->b0,
- _("test statistic"), taustr, ainfo->tau);
+ pprintf(prn, " %-.34s\n %-22s = %9.6f\n"
+ " %-s: %-11s = %7.4f\n",
+ "--------------------------------------------",
+ _("estimated a-1"), ainfo->b0,
+ _("test stat"), taustr, ainfo->tau);
if ((opt & OPT_G) && i+1 == UR_TREND) {
double c[4];
@@ -680,13 +690,14 @@
}
if (!na(dfmod->rho)) {
- pprintf(prn, " %s: %.3f\n", _("1st-order autocorrelation coeff. for
e"),
+ pprintf(prn, " %s: %.3f\n", _("1st-order residual autocorr"),
dfmod->rho);
}
if (ainfo->order > 1) {
show_lags_test(dfmod, ainfo->order, prn);
}
+ // pputs(prn, " ------------------------------------\n");
}
/* test the lag order down using the t-statistic criterion */
gretl version 1.10.90cvs
Current session: 2015-06-30 22:35
? open denmark
Read datafile /usr/local/share/gretl/data/misc/denmark.gdt
periodicity: 4, maxobs: 55
observations range: 1974:1 to 1987:3
Listing 5 variables:
0) const 1) LRM 2) LRY 3) IBO 4) IDE
? adf 2 IBO
IBO: Augmented Dickey-Fuller test
including 2 lags of diff(IBO)
sample size: 52
(H0: unit-root, a = 1)
with constant:
( diff(y) = cnst + (a-1)*y(-1) + ... + res )
----------------------------------
estimated a-1 = -0.060000
test stat: tau_c(1) = -1.3994
asymptotic p-value = 0.5843
----------------------------------
1st-order residual autocorr: -0.053
lagged diff exclusion test: F(2, 48) = 6.419 [0.0034]
with constant and trend:
( diff(y) = cnst + b1*t + (a-1)*y(-1) + ... + res )
----------------------------------
estimated a-1 = -0.078494
test stat: tau_ct(1) = -1.7100
asymptotic p-value = 0.7472
----------------------------------
1st-order residual autocorr: -0.073
lagged diff exclusion test: F(2, 47) = 6.503 [0.0032]