Hi everybody

It looks nice!!!! By the way,  a picture being worth a bunch of words,
could the following one, developped in R (link below) be translated into
hansl/gretl?

https://www.r-bloggers.com/tell-me-a-story-how-to-generate-textual-explanations-for-predictive-models-2/

Best,
Artur

Le mer. 6 nov. 2019 à 08:03, Riccardo (Jack) Lucchetti <
r.lucche...@univpm.it> a écrit :

>
> Ok, this is so offtopic that is nearly embarassing, but here goes.
>
> I found on the net the attached picture (quite amazing in itself), so I
> thought it'd be nice to write a hansl script to reproduce it. It turns
> out the the little script below showcases quite a few features hansl has
> (eg recursion, logical operators etc), so it could maybe be useful to
> people who are teaching/learning Hansl. Enjoy!
>
> <hansl>
> set verbose off
>
> function matrix prime_sieve(scalar n)
>      x = floor(sqrt(n))
>      c = seq(2,n)
>      prime = ones(1,n-1)
>      loop i = 2 .. x --quiet
>          prime[i+1:] = prime[i+1:] && !(c[i+1:] % i .= 0)
>      endloop
>      return selifc(c, prime)
> end function
>
> function scalar droot(scalar x)
>      y = floor(x)
>      ret = 0
>      loop while y >= 1 --quiet
>          ret += y % 10
>          y = floor(y/10)
>      endloop
>
>      if ret > 9
>          ret = droot(ret)
>      endif
>
>      return ret
> end function
>
> x = prime_sieve(200)
>
> loop i = 1 .. nelem(x) --quiet
>      c = x[i]^3
>      printf "%5d: %5d\n", x[i], droot(c)
> endloop
> </hansl>
>
> -------------------------------------------------------
>    Riccardo (Jack) Lucchetti
>    Dipartimento di Scienze Economiche e Sociali (DiSES)
>
>    Università Politecnica delle Marche
>    (formerly known as Università di Ancona)
>
>    r.lucche...@univpm.it
>    http://www2.econ.univpm.it/servizi/hpp/lucchetti
>
> -------------------------------------------------------_______________________________________________
> Gretl-users mailing list -- gretl-users@gretlml.univpm.it
> To unsubscribe send an email to gretl-users-le...@gretlml.univpm.it
> Website:
> https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/
>
_______________________________________________
Gretl-users mailing list -- gretl-users@gretlml.univpm.it
To unsubscribe send an email to gretl-users-le...@gretlml.univpm.it
Website: 
https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/

Reply via email to