Dear Allin,
thank you for your response, I just read it today morning and so I could test
the small script you sent and compare with mine.
Well, here are the results:
1) you script works perfectly well;
2) the first part of mine also... now I can define my matrices by named list
assignement and it works ok.
I guess there is some arcane win XP problem around here... gretl does not seem
to be culprit !
But now I have problems with the second segment of my script :
############################################################################
matrix W1=zeros(257,258)
list contigus1 = 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
matrix VW1={contigus1}
loop i = 1..257 --quiet
scalar row=$i
loop j = 1..15 --quiet
scalar col=VW1[$i,$j]
matrix W1[row,col]=1
end loop
end loop
matrix WL1=W1[,1:257]
delete W1
### calcul de la matrice de lissage
matrix DEGW1=1./sumr(WL1)
matrix INVDEG=I(257).*DEGW1
matrix W1W=WL1*INVDEG
### lissage d'ordre 1 des donnees a l'aide de la matrice de contiguite
matrix LISS1=W1W*X
loop m=1..12
series lw1$m=LISS1[,$m]
end loop
############################################################################
When i run it: gretl says :
gretl version 1.8.0
Current session: 2009/02/03 15:38
? matrix W1=zeros(257,258)
Replaced matrix W1
? list contigus1 = 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
Replaced list contigus1
? matrix VW1={contigus1}
Replaced matrix VW1
? loop i = 1..257 --quiet
scalar row=$i
loop j = 1..15 --quiet
scalar col=VW1[$i,$j]
matrix W1[row,col]=1
end loop
end loop
Index value 0 is out of bounds
> matrix W1[row,col]=1
> loop j = 1..15
i dont see why he finds an index value 0 while the loops are indexed from 1 to
257 for i and 1 to 15 for j ?
I could continue with the other script but i need these computations for
comparison.
To be brief, the script computes from a data set (matrix X), the matrix of
spatially smoothed data (each observation is replaced by the mean of its
immediate neighbors). A contiguity (neighborhood) matrix is read from the list
of indexes of the neighbors of each information stored in the matrix VW1 =
{contigus1}.
But as i said, i cannot create the matrix. Ooops, yes should have stored it
once and for all, long ago ! But once i have fixed that, i will send the tests
to the community.
thanx for help and cheers.
Franck