I'm working since weeks now on a comprehensive 'SummaryBy' function. It's not that easy as it seems, especially if u want something like a combination of discrete variables (and to use it for tests like Box-M...). With a bunch of new hansl functionalities the target has come closer! Thanks Allin for implementing the new stuff!!!

At the moment my function makes all necessary calculations but the user has  to be informed correctly what summaries he receives (The bivariate interaction is not a problem anymore).

In terms of multivariate statistic I also programmed:

-Mardia Test for multivariate norm dist
-MANOVA
-Linear Discriminant Analysis
-Scale function for standardization
-renumber function for discrete series

Whenever it comes to calculating variances a MLE switch is included in order to compare the results to e.g. R.

I hope to get the package work for productive use soon, so that I can upload it :-)

Leon

Am 19.02.2013 um 19:50 schrieb ahmadou dicko <dicko.ahmadou@gmail.com>:

Thank you very much this is exactly what I was looking for.
I'll try to understand better hansl to improve this function and generalized it.

I think that having a  general "by" operator for common aggregator functions (max, mean, etc.) can be useful for other Gretl users.
Thanks again for this example showing hansl capabilities.

On Tue, Feb 19, 2013 at 6:40 PM, Allin Cottrell <cottrell@wfu.edu> wrote:
On Tue, 19 Feb 2013, ahmadou dicko wrote:

> I want to thank again all Gretl developpers for this wonderful software.

Glad you like it!

> I try to port some of my R code into Gretl and I miss few things.
>
> For example, what is the easiest way to perform some aggregate operation in
> Gretl like :
>
>  - aggregate(x, by = y, FUN) in R

This functionality is not built-in (except in relation to the
"summary" command, using the --by option). However it's
possible to write a function to do this sort of thing. The
following is not very general but should give you the idea:

<hansl>
function matrix aggregate (series x, series y, string funname)
   matrix m = values(y) ~ 0
   loop i=1..rows(m) --quiet
     smpl y == m[i,1] --restrict --replace
     m[i,2] = @funname(x)
     printf "@funname(x) for y=%g: %g\n", m[i,1], m[i,2]
   endloop
   colnames(m, "y f(x)")
   return m
end function

open credscore.gdt
m = aggregate(Income, Acc, "mean")
print m
m = aggregate(Income, Acc, "sd")
print m
</hansl>

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



--
Ahmadou H. DICKO
Data scientist and applied economist
PhD student in Climate change economics
Faculty of economics and managment - Cheikh Anta Diop University
West African Science Service Center on Climate Change and Adaptated Land Use (WASCAL)
Center for Development Research (ZEF) - University of Bonn
twitter : @dickoah
skype : dicko.ahmadou.h
tel : 33 827 55 16
_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users