# Articles by Todos Logos

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

January 20, 2015 |

### ggPlot2: Histogram with jittered stripchart

February 5, 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 rug... [Read more...]

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

February 2, 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 + st... [Read more...]

### Implementation of the CDC Growth Charts in R

September 17, 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, a... [Read more...]

### R is a cool sound editor!

September 7, 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 ... [Read more...]

### R is a cool image editor #2: Dithering algorithms

August 29, 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 passing over a matrix); ... [Read more...]

### Benford’s law, or the First-digit law

August 25, 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 ... [Read more...]

### How to plot points, regression line and residuals

June 16, 2011 |

x y # plot scatterplot and the regression linemod1 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 valuesres pre # plot distances between points and the regression linesegments(x, y, x, pre, col="red")# add labels (... [Read more...]

### R is a cool image editor!

November 7, 2010 |

Here I present some functions I wrote to recreate some of the most common image effect available in all image editor.They require the library rimage.To load the image, use:y [Read more...]

### Fast matrix inversion

October 19, 2010 |

Very similar to what has been done to create a function to perform fast multiplication of large matrices using the Strassen algorithm (see previous post), now we write the functions to quickly calculate the inverse of a matrix.To avoid rewriting pages and pages of comments and formulas, as I ... [Read more...]

### Fast matrix multiplication in R: Strassen’s algorithm

October 18, 2010 |

I tried to implement the Strassen's algorithm for big matrices multiplication in R.Here I present a pdf with some theory element, some example and a possible solution in R.I'm not a programmer, so the function is not optimize, but it works.I want to th... [Read more...]

### Convert decimal to IEEE-754 in R

October 6, 2010 |

For some theory on the standard IEEE-754, you can read the Wikipedia page. Here I will post only the code of the function to make the conversion in R.First we write some functions to convert decimal numbers to binary numbers:decInt_to_8bit q r xx for(i in 1:... [Read more...]

### Bhapkar V test

April 28, 2010 |

This is the code to perform the Bhapkar V test. I've rapidly wrote it, in 2 hours. The code is then quite brutal and it could be done better. As soon as possible, I will correct it.WARNING: it works *ONLY* with 3 groups, for now!bhapkar.test.3g sample for(i ... [Read more...]

January 6, 2010 |

The Latin square design is used where the researcher desires to control the variation in an experiment that is related to rows and columns in the field.Remember that: * Treatments are assigned at random within rows and columns, with each treatment once per row and once per column. * There are ... [Read more...]

### Polynomial regression techniques

September 5, 2009 |

Suppose we want to create a polynomial that can approximate better the following dataset on the population of a certain Italian city over 10 years. The table summarizes the data:$$\begin{tabular}{|1|1|}\hline Year & Population\\ \hline 1959&4835\\ 1960&4970\\ 1961&5085\\ 1962&5160\\ 1963&5310\\ 1964&5260\\ 1965&5235\\ 1966&5255\\ 1967&5235\\ 1968&5210\\ 1969&5175\\ \hline \end{tabular}$$First we import the data into R:Year Population Now we create ... [Read more...]

### Web-site trend analysis with data from Google Analytics

August 25, 2009 |

This post is a summary of my two previous posts on the trend analysis with the Cox-Stuart test and on simple linear regression. The goal that we propose is to assess the trend in the number of visits received from a site over a long time. I use Google Analytics, ... [Read more...]

### Simple logistic regression on qualitative dichotomic variables

August 20, 2009 |

In this post we will see briefly how to implement a logistic regression model if you have categorical variables, or qualitative, organized in double entry contingency tables. In this model the dependent variable (Y) and independent variable (X) are both dichotomies (or Bernoullian).In general, the probability that Y = 1 as ... [Read more...]

### Trend Analysis with the Cox-Stuart test in R

August 8, 2009 |

The Cox-Stuart test is defined as a little powerful test (power equal to 0.78), but very robust for the trend analysis. It is therefore applicable to a wide variety of situations, to get an idea of the evolution of values obtained. The proposed method is based on the binomial distribution. In ... [Read more...]

### Two-way analysis of variance: two-way ANOVA in R

August 7, 2009 |

The one-way analysis of variance is a useful technique to verify if the means of more groups are equals. But this analysis may not be very useful for more complex problems. For example, it may be necessary to take into account two factors of variability to determine if the averages ... [Read more...]

### Contingency table and the study of the correlation between qualitative variables: Pearson’s Chi-squared test

August 4, 2009 |

If you have qualitative variable, it is possible to verify the correlation by studying a contingency table R by C, using the Pearson's Chi-squared test.A casino wants to study the correlation between the modes of play and the number of winners by age group, to see if the number ... [Read more...]
1 2