[Gretl-devel] gretl <-> R interaction

Riccardo (Jack) Lucchetti r.lucchetti at univpm.it
Mon Apr 14 03:20:10 EDT 2008


Hi everyone,

last week, Allin and I worked on better integration with R, and it would 
be very helpful if some of you guys could test a new feature, which is 
available in the current CVS version and/or the windows snapshot: you can 
now edit R sources and have R execute them, with the data in your current 
gretl session auto-loaded for you.

An example will probably clarify:

1) load the "data4-1.gdt" example file
2) run an OLS regression of "price" on the other 3 variables: you should 
get something like

   const               129.062           88.3033        1.462   0.17456
   sqft                  0.154800         0.0319404     4.847   0.00067 ***
   bedrms              -21.5875          27.0293       -0.799   0.44304
   baths               -12.1928          43.2500       -0.282   0.78376

3) now open Files > Script files > New and choose "R script"
4) an edit window should open: write the following R commands:

   mod1 <- lm(price ~ sqft+bedrms+baths)
   summary(mod1)

5) click on the gears icon and choose "Non interactive"
6) after a few moments, an output window should open with the results, 
among which:

                Estimate Std. Error t value Pr(>|t|)
   (Intercept) 129.06163   88.30326   1.462 0.174559
   sqft          0.15480    0.03194   4.847 0.000675 ***
   bedrms      -21.58752   27.02933  -0.799 0.443037
   baths       -12.19276   43.25000  -0.282 0.783758

(Hey, the same numbers! Amazing!)

IMHO, this mechanism (if working properly) will be very beneficial to 
gretl _and_ R users. However, it is not very well tested, and anything can 
happen (crashes, data losses, kittens being eaten, your house on fire). 
So, I'd like to invite anyone who has even a marginal interest in R to 
give this new feature a good run, so we can debug it properly before the 
next release.

Thanks.


Riccardo (Jack) Lucchetti
Dipartimento di Economia
Università Politecnica delle Marche

r.lucchetti at univpm.it
http://www.econ.univpm.it/lucchetti


More information about the Gretl-devel mailing list