Re: [Gretl-users] ANOVA
by andreas.rosenblad＠ltv.se

geno83(a)gmail.com @ wrote 2008-04-17 19:12:44 :
> Hello
>
> I'm working on ANOVA. I want put one way Anova and two way Anova to
gretl.
> I made first version of one way ANOVA. It is still test version, but
> it's working.
> You can download sources and test it.
> I will be glad if you put ANOVA to gretl official version.
>
Very good. ANOVA is one of the features I have missed in gretl. I hope that
you will continue to contribute code to gretl.
Best regards,
Andreas
16 years, 1 month

matrix indexes question after sort
by Franck Nadaud

Hi all, greetings from Paris !
I am still developping my spatial tools under gretl, but I have a difficulty
with some matrix functions. My code is an adaptation of the "brute force"
find_neighbor of James LeSage.
Let me explain, I am given a list of coordinates for my data (spatial X and Y
location coordinates). The function is to find the k nearest neighbors of each
of my N data points.
The function computes for each of them a distance to all the others, then i
call a sort command to order the distances from smallest to largest to finally
extract the k smallest distances i am interested in (starting from line 2 to
k+1 because the lowest distance is zero, ie: the shortest distance to data i
is itself !).
Well, my problem is that I do not see how to grab not the values of sorted
distances but the indexes of data points. Here is the code :
matrix xc = X_COORD
matrix yc = Y_COORD
scalar n = rows(xc)
### i fix the number of near neighbors to 4, a typical value (rook neighborhood)
scalar m = 4
### I create a list of indexes of each of the 4 nearest neighbors set to zero
matrix nnlist = zeros(n,m)
### I added this dirty trick to keep track of the indexes I want to sort with
### the distances:
matrix idx = transp(seq(1,n))
### the main (brute force) loop
loop i = 1..n --quiet
matrix xi = xc[$i,1]
matrix yi = yc[$i,1]
matrix dist = sqrt((xc-xi*ones(n,1)).^2 + (yc - yi*ones(n,1)).^2)~idx
matrix xind = sort(dist[,1])
matrix nnlist[i,1:m] = transp(xind[2:m+1,1])
end loop
### I display the results to see the results
dist
xind
nnlist
As you can see, I compute a matrix dist holding distances concatenated with
indexes. Then i sort the distances and store them into the matrix xind. The
problem is that, I am not interested by the distances, but the indexes of the
units but xind only returns a vector of sorted distances and not the indexes.
In fact i would be interested in just extracting the values of indexes in the
sorted dist matrix. I do not understand how to use the command sort for
matrices.
any advice ?
thanx & cheers
Franck
PS: a text file with my (X,Y) data
--
Franck Nadaud
Economiste
CIRED
UMR 8568 CNRS - EHESS
45 bis avenue de la Belle Gabrielle
94736 Nogent-sur-Marne Cedex
TEL 33-1-43-94-73-94
FAX: 33-1-43-94-73-70
MOB: 06-07-39-92-75
France
16 years, 6 months

variable names
by Stefano Balietti

Is there a way to know the name of a variable at a given position in a list?
Obviously I don't have the ID of the variable. I knew the command:
argname( variable) but it isn't working, it returns an empty string.
Cheers
Stefano
16 years, 6 months

cvs version
by Marco Grazzi

Hi all,
Apologize if this is stupid or already reported, but I did not find this in the archive.
I am using gretl (compiled from the cvs) on linux-gentoo.
When I run gretl I get the following error messages
$ gretl
set_lcnumeric: getenv("LANG") gave NULL
get_gretl_charset gave (null)
help file /usr/local/share/gretl/gretlcmd.hlp is not accessible
help file /usr/local/share/gretl/gretlgui.hlp is not accessible
Apparently, the help files are not in the repository, but what about the first two messages?
thanks a lot
marco
16 years, 6 months

Re: Coefficient restrictions (Riccardo (Jack) Lucchetti)
by Mixon, Wilson

Jack,
Thanks. This works like a charm.
Wilson
My problem: Regressing the returns from a portfolio against the returns from several market benchmarks. Restrict the model so that each
coefficient is non-negative and they sum to 1. Suggestions?
Jack's solution: Express (n-1) portfolio weights as squared parameters and the n-th one as 1 minus all the others. Estimate via nls. Example:
nls rPORT = w1*rSP500 + w2*rSP400 + w3*rSP600
w1 = b1^2
w2 = b2^2
w3 = 1 - w1 - w2
params b1 b2
end nls
16 years, 6 months

Coefficient restrictions
by Mixon, Wilson

One of my former students has this problem: "The project involves regressing the returns from a portfolio against the returns from several market benchmarks (the S&P500, the S&P Midcap 400, the S&P Small-cap 600, and treasury bills). When the regression is restricted so that all of the coefficients are non-negative and sum to 1, the coefficients will identify which asset classes best explain the portfolio's returns, and therefore what style the portfolio manager is using. I figured out how to get the coefficients to sum to one using linear restrictions, but I can't seem to find any function or command in GRETL which will impose the non-negative restriction on the regression. Any ideas?"
I don't know what to tell him. Suggestions?
Thanks,
Wilson Mixon
16 years, 6 months

Simulation using GRETL
by esam habes

Hi everone..I am a senior and trying to finalize my research paper ..I need
help..when i try to estimate using Maximum Likelihood Method, Gretl responds
by asking for an MLE function. While I know the density and hence
loglikelihood function for the normal variable, I get an error respnse when
I try to write the function inside the dialogue box..Is there a specific
format in which I must write the function which Gretl asks for? I would be
grateful for an example.
Sincerely
Esha
16 years, 6 months

matrix sorting: you save the day !
by Franck Nadaud

Hello all, Allin & Jack !
You really saved my day ! Let me sum up the situation.
I tested both scripts, they run perfectly !
In fact the msortby command is not documented yet, this is why i had trouble
to translate the find_nn command of James Lesage.
Now I can compute the right neighborhood matrices from a whole sample and
subsamples of interest. This is really neat because once they are created we
can compute spatial autocorrelation coefficients directly using matrix
commands or via regression with bootstrap of p-values :the moran scatterplots
of Luc Anselin, which have the interest of providing real confidence
intervals.
My tests show small differences in results from GEODA and the GRETL scripts I
use now. This is all good news and I will rest on your input to propose a few
scripts and/or functions to compute tests for spatial autocorrelation I will
submit to the community. I hope to write a short note and propose my scripts
soon so that users can grasp the basics of those tests.
Returning to the matter of neighbors, and programming, there are far smarter
algorithms than the brute force hack I work on, but think it better to propose
the simple scripts first before turning on the real smart ones which consist
in exploring the neighborhood graph with special functions and pointers. More
of this when the work will be more advanced.
First i will propose the Moran spatial autocorrelation test as a function
using two types of neighborhood structures: contiguity (common border) and
nearest neighbors with choice in the number of neighbors on two kind of grids
too: either square (checkboard) or hexagonal.
Well, thanx very much Allin and Jack !
more about that soon !
cheers
F.
--
Franck Nadaud
Economiste
CIRED
UMR 8568 CNRS - EHESS
45 bis avenue de la Belle Gabrielle
94736 Nogent-sur-Marne Cedex
TEL 33-1-43-94-73-94
FAX: 33-1-43-94-73-70
MOB: 06-07-39-92-75
France
16 years, 6 months

Problem with linear restriction
by t.artur＠freenet.de

Hello helpful gretl-community,
I am using gretl 1.7.4 on windows as well as linux.
I tried to impose this restriction:
b1/b2=0
but gretl only tests this one:
b1=0
I verrified this by just omitting b1 via the Wald-test. The results are the same.
Why does gretl not use my original restriction?
artur
16 years, 6 months