Publications by Todos Logos

How to plot points, regression line and residuals

16.06.2011

x <- c(173, 169, 176, 166, 161, 164, 160, 158, 180, 187) y <- c(80, 68, 72, 75, 70, 65, 62, 60, 85, 92) # plot scatterplot and the regression line mod1 <- lm(y ~ x) plot(x, y, xlim=c(min(x)-5, max(x)+5), ylim=c(min(y)-10, max(y)+10)) abline(mod1, lwd=2) # calculate residuals and predicted values res <- signif(residuals(mod1), 5) pre <- predict(...

929 sym 2 img

Benford’s law, or the First-digit law

25.08.2011

Benford’s law, also called the first-digit law, states that in lists of numbers from many (but not all) real-life sources of data, the leading digit is distributed in a specific, non-uniform way. According to this law, the first digit is 1 about 30% of the time, and larger digits occur as the leading digit with lower and lower frequency, to the...

1449 sym 2 img

R is a cool image editor #2: Dithering algorithms

29.08.2011

Here I implemented in R some dithering algorithms: – Floyd-Steinberg dithering – Bill Atkinson dithering – Jarvis-Judice-Ninke dithering – Sierra 2-4a dithering – Stucki dithering – Burkes dithering – Sierra2 dithering – Sierra3 dithering For each algorithm, I wrote a 2-dimensional convolution function (a matrix passi...

1466 sym R (390 sym/9 pcs) 18 img

R is a cool sound editor!

07.09.2011

Capabilities of R are definitely unless! After my previous posts about some easy image editing in R (they are here, and here), now is the time to explore if R is capable of sound editing!Just for fun, here I created a function that receives a phone number (or another sequence of numbers), and returns the equivalent melody you can list...

1286 sym

Implementation of the CDC Growth Charts in R

17.09.2011

I implemented in R a function to re-create the CDC Growth Chart, according to the data provided by the CDC.In order to use this function, you need to download the .rar file available at this megaupload link.Mirror: mediafire link.Then unrar the file, and put the Growth folder in your main directory, as selected in R. You are now able ...

3520 sym R (2751 sym/6 pcs)

Boxplot with mean and standard deviation in ggPlot2 (plus Jitter)

02.02.2014

When you create a boxplot in R, it automatically computes median, first and third quartile (“hinges“) and 95% confidence interval of median (“notches“).But we would like to change the default values of boxplot graphics with the mean, the mean + standard deviation, the mean – S.D., the min and the max values.Here is an examp...

845 sym 2 img

ggPlot2: Histogram with jittered stripchart

05.02.2014

Here is an example of a Histogram plot, with a stripchart (vertically jittered) along the x side of the plot.Alternatively, using the geom_rug function:Of course this simplicistic method need to be adjusted in vertical position of the stripchart or rugchart (y=-2, here), and the relative proportion of points jittering. Related To l...

733 sym 4 img

Adjustment for Multiple Comparison Tests with R: Resources on the web

20.01.2015

1. Bonferroni correctionp.adjust(p, method = “bonferroni”)Read: http://en.wikipedia.org/wiki/2. Sidak (Dunn-Sidak) correctionRead: http://en.wikipedia.org/wiki/3. Holm-Bonferroni correctionp.adjust(p, method = “holm”)Read: http://en.wikipedia.org/wiki/4. Hochberg correctionp.adjust(p, method = “hochberg”)Read: http://stats.stackexchan...

1186 sym