Monday, November 7, 2011

Free the research #0

I decided to publish here, in serial form, the translation of an article I wrote for GNU/Linux Magazine Italy some months ago. Please take note that this post, as all the content of this blog, is released under Creative Commons Attribution 3.0 There will be 4 parts, dedicated to RKWard, Maxima, Kile, and Avogadro+Kalzium. Ok, let's start...


The work of the researcher has changed a lot in the last years, and it's still changing: we heavily use computers. If some time ago we used to draw plot by hand, now we use computer programs, articles and reports were written with a writing machine, and now they are written and shared digitally (for example in PDF). The biggest calculations are made by computers, not by humans. This means that a lot of computer tools are needed, and everybody knows that their price is not always low.


In this situation, the free software can be a very interesting choice, because of it's more stupid meaning ("free" as in "free beer"). Obioulsy free software should be used by researchers also because the knowledge must be accessible by everyone, and it should not have barriers obstructing the freedom to read something written by another person. Also free hardware could be interesting, but there are not so much projects (Arduino could be wonderful, in the future).
Free software programs are actually able to replace proprietary software, and that's what I'm going to show in this article. 




RKWard
Website: http://rkward.sourceforge.net/
R is a powerful language for data analisys, completely free, and it has a CLI (Command Line Interface) interpreter. To make its use easyer, anyway, there are many GUIs (Graphic User Interface): one of the better developed is RKWard. Starting RKWard, the program will ask us what we want to do: for example, we could choose to create a new table. We will see a two-part view: in the upper section it's possible to manage the variables (they will represent the table's columns) specifying name and format. In the lower part of that view, instead, there is the table itself: the columns, obiously, are those we created in the upper section. Now, please remember that, for doing some particular tasks, R may need some packages to be included in the project: to install them, there is a simple package manager integrated directly into RKWard. The only problem is that the installation is not possible if you have no root privileges. This means you will have to save your work, close the program then reopen it with 
kdesudo rkward
It's also possible to write this command directly into KRunner, pressing Alt+F2, and no need to open a console.
To save the project simply follow the menu Workarea/Save workarea.
After we have inserted our datas into the table, it's possible to start working on them: the menĂ¹ Plot contains various kind of plots. If you want to obtain the classical dispersion plot, just use GenericPlot: the "Plot Options" button allows you to configure the plot in every characteristic. To make another example, BoxPlot shows the deviation of a variable's values: in its options, we can choose to see the mean or the standard deviation (SD).
Using the R console (accessible from one of the buttons in the lower part of the window) it's possible to write directly in R language. For example, the command:
model<-lm(formula = my.data[["Y-axis"]] ~ my.data[["X-axis"]])
allow us to build a model (that is called "model"... original, isn't it?) in which we study the relation between the variable we called Y-axis and the one called X-axis. It would be, then, a good idea to check that the linear regression makes sense, with the Students test:
errors<-residuals(model)
t.test(errors)
The program will write a report that ends with the "mean of x": if this value is near to zero, this means that the linear regression we used really works. If this is the case, we would like to obtain a plot. Just use the command:
plot(model)
R will give us many different kind of plots (after drawing one, we have to press "Enter") and, at the end, we can use the buttons previous plot and next plot to see them all.

No comments:

Post a Comment