Am 28.02.2013 19:11, schrieb Allin Cottrell:
On Thu, 28 Feb 2013, Pindar wrote:

I really appreciate the new functionalities of aggregate()!
Glad you like!

At first some comments:
   a) including the cases is very useful
   b) in terms of the NaN rows in a matrix, well I'm not that sure, in my 
function I skip them at the moment, but perhaps sometimes
       it's exactly those combinations one likes to know. Is there already a 
way that generates a copy of a matrix without lines including missings?
Yes:

<hansl>
m = aggregate(X, A, mean)
m = selifr(m, !isnan(m[,cols(m)]))
</hansl>
Good to know!

      
   c) what about the mcov() function as 'aggregator function'?
I don't see how that could work, since mcov() takes a matrix 
argument and returns a matrix. If you had exactly 2 
x-variables then I suppose cov() or corr() could be used as 
the aggregator.
I gonna have a look at how to use these functions instead.

      
Second, I'm of the opinion that there is a quite important and user friendly 
option missing:
It's about combinatorics.
Although one has e.g. 5 discrete variables one wants e.g. ONLY ALL BIVARIATE 
combinations.
This should be done by GRETL and not by hand.
Well, I'm not sure about that, since it's trivial to write 
your own wrapper to do that sort of thing, as in
Oh 'matrix amat =A' is much shorter then 'getIDs'!
Well, yes it's easy, but I like the COMBIs function more, because it generates from a random vector with e.g. integers
the binomial combinations of the elements and stores them in the columns of a new matrix.

Ah, I always tries this in vain...

 'loop foreach i A
    j=i+1
    'loop foreach j A


<hansl>
list A = female college ages
list X = pizza income
matrix amat = A
scalar ny = cols(amat)
loop i=1..ny -q
   loop j=i+1..ny -q
     list Bin = amat[i] amat[j]
     m = aggregate(X, Bin, mean)
     print m
   endloop
endloop
</hansl>

Allin Cottrell
_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users