Hi all,
I am not sure whether the following is actually intended or not. The
help does not mention any limits, though.
For a project, I stumbled over the following:
1. Create a matrix of residuals with NAs as initial values.
2. Name the columns of the matrix.
3. Store the columns of the matrix as series using the mat2list() function.
In my case, I did not pass any prefix as a 2nd optional argument to
mat2list(). The names of the matrix columns are the same as _already_
existing series. This implies that the application of mat2list()
over-writes existing series values. It took me a while to understand
what's going on and where the error in my code is.
Questions:
Is it intended (the help does not state anything explicitly) that
mat2list() is allowed to overwrite values of some existing series?
If so, I think it's useful to provide a warning for the user, stating
that values of some series are over-written. What do you think?
Here is an example:
<hansl>
set verbose off
clear
open denmark -q
list L = dataset
scalar popt = 4
var popt L --silent
# Store residuals
## take into account the NA values for the initial obs.
smpl +popt ;
matrix uhat = $uhat
## name the residuals equal to the original input series
cnameset(uhat, varnames(L))
## add the named residuals to the dataset
list Comps = mat2list(uhat)
smpl full
# as can be seen: the residuals and original series are mingled
print Comps -o --range=1:10
</hansl>
Thanks
Artur