
52 2 Phenomenological Models
(GUI) for R. Appendix B explains the way in which you start the R Commander
within CAELinux.
Before starting the analysis, the data should be saved in the ‘‘csv’’ data format, for
example, by using Calc’s ‘‘Save as’’ menu option. The resulting ‘‘.csv’’ file can then
be imported via the R Commander’s ‘‘Data/Import data/From text file’’ option (be
careful to choose ‘‘,’’ as the field delimiter when saving or importing csv files). After
this, the same descriptive analysis as in the last section can be performed by using
the R Commander menu options. For example, the arithmetic mean and the stan-
dard deviation can be obtained using the ‘‘Statistics/Summaries/Numerical sum-
maries’’ menu option, graphs can be created via the ‘‘Graphs’’ menu option and so
on. (‘‘Graphs/Scatterplot’’ creates scatterplots similar to Figure 1.9 in Section 1.5.6).
If the standard formatting of the graphs produced by the R Commander does not
meet your requirements, you can generate a great variety of possible formats based
on R programs (see Appendix B for details on using R programs). Look through
the various R programs in the book software (Appendix A) to see how this can be
done, or consult the literature that is recommended in Appendix B. As an example,
consider the program
HeatClos.r that you find in the MechPDE directory of the
book software. This program generates a plot using R’s
plot command, and the
plot involves, for example, a nonstandard font size and a nonstandard line width.
Looking into the
plot command in HeatClos.r, you will see that the font size
can be adjusted using a
par command which is issued immediately before the
plot command, and the line width can be set using the lwd option of the plot
command.
The R commander provides a script window that can be used to facilitate your
first steps in R programming. Everything you do in the R Commander is translated
into appropriate R code within the script window. For example, after producing a
scatterplot using the R Commander’s ‘‘Graphs/Scatterplot’’ menu option, you will
find a
scatterplot(...) command in the script window that corresponds exactly
to all the choices that you have made in the ‘‘Graphs/Scatterplot’’ window. If you
then copy and paste the content of the script window into a text file and save that
file with extension ‘‘.r’’, the resulting program can be executed as described in
Appendix B, and it will generate exactly the result that you have produced before
using the R Commander.ThisR program can then be edited and optimized, for
example, by using formatting commands as described above.
2.1.2
Random Processes and Probability
Suppose you are interested in some quantity which we denote by X,andwhichmay
be temperature, the concentration of some substance, and so on. You will usually
need to have precise measurements of that quantity, so let us assume that you
have a new measurement device and want to know about the measurement errors
produced by that device. Then, a standard procedure is to repeatedly measure that
quantity in a situation where the correct result is known (e.g. by using standardized