On Fri, 20 Nov 2020, Sven Schreiber wrote:
Hi,
I'm noticing that the plain cholesky-based C matrix which is stored
after 'var' estimation in $system.C is not square. For example
estimating a 2-dim VAR with 2 lags I get a 4x2 matrix there; however the
bottom half is just zero, and the top is equal to cholesky($sigma) alright.
It seems to come from VAR_allocate_cholesky_matrix in lib/src/var.c,
where we have:
n = var->neqns * effective_order(var);
var->C = gretl_zero_matrix_new(n, var->neqns);
So the number of rows is indeed chosen as dim x lagorder which explains
my row number 4 above - but this doesn't make any sense, does it?
That C matrix is described in var.h as "augmented
Cholesky-decomposed error matrix". I can't say I remember the exact
reason for augmenting it with zeros, but as things stand it's
required for conformability in functions such as
gretl_VAR_get_fcast_decomp(). Just making C square would definitely
break things, though there may be a smarter approach that doesn't
need the augmentation. (At a quick peek, this might require
replacement of a straight matrix addition with addition of a small
matrix to a region of a larger one.)
Even if we decide using the augmented C is more efficient for
internal usage, we could trim it when writing to the $system bundle.
Allin