On Sat, 28 Oct 2006, Rob Tischer wrote:
 FYI. The biggest problems I had were moving between matrices and 
 variables, and trying to save variables with fewer than the 
 number in the initial dataset (other than 1x1). 
Here is the issue with saving matrices as "ordinary variables" 
(series): If the matrix has as many rows as there are observations 
in the data set, or as many rows as in the current sample range, 
then gretl knows how to align the values from the matrix with the 
other data series.  (In the second case the out-of-sample values 
are implicitly NA.)  Otherwise, the program has no way of knowing 
how the values should be aligned, and you'll have to help.
There are two ways of doing this (without adjusting the sample 
range), one using a temporary matrix and one using a loop 
construct.  Here's a trivial example of making a series x, of 
length 20, out of a matrix (column vector) M, of length 10, using 
a temporary matrix Tmp, with the 10 values in M aligned at the end 
of the dataset and padded with zeros.  (I'm using the syntax for 
defining matrix expressions that is supported in CVS and the 
current Windows snapshot):
nulldata 20
matrix M = mnormal(10,1)
matrix Tmp = zeros(20,1)
Tmp[11:20,] = M
series x = Tmp
delete Tmp
print x --byobs
Here's the same thing done using a loop:
nulldata 20
matrix M = mnormal(10,1)
series x = 0
loop i=11..20
   x[$i] = M[$i-10,1]
end loop
print x --byobs
You could actually do the same thing using the smpl command too:
nulldata 20
matrix M = mnormal(10,1)
series x = 0
smpl 11 20
x = M
smpl --full
print x --byobs
Allin Cottrell