Publications by Todos Logos
Trend Analysis with the Cox-Stuart test in R
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 R there is no function to perform a test o...
2628 sym R (1720 sym/10 pcs)
Simple logistic regression on qualitative dichotomic variables
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 a function ...
3770 sym R (1678 sym/5 pcs) 2 img
Web-site trend analysis with data from Google Analytics
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, because this tool allows us to save the various reports in Excel CSV form...
3579 sym R (1022 sym/7 pcs) 10 img
Polynomial regression techniques
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...
5018 sym R (3948 sym/17 pcs) 10 img
Latin squares design in R
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 equal numbers of rows, columns, and ...
2000 sym R (2421 sym/5 pcs) 2 img 1 tbl
Bhapkar V test
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 <- function(data1=list){ sample <- c() for(i in 1:length(data1)){ sample <- c(sample, re...
755 sym R (1630 sym/2 pcs)
Convert decimal to IEEE-754 in R
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 <- function(x, precs) { q <- c() r <- c() xx <- c() for(i in 1:precs){ xx[1] <- x q[i] <- xx[i]...
3153 sym
Fast matrix multiplication in R: Strassen’s algorithm
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 thank G. Grothendieck: suggested me a very nice way on StackOverFlow to create a b...
1045 sym
Fast matrix inversion
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 did for matrix multiplication, this time I�...
2021 sym R (5254 sym/5 pcs) 2 img
R is a cool image editor!
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.jpeg("path")To display the image, use:plot(y)Original imageSepia tonergb2sepia <- function(img){ iRed <- img[,,1]*255 iGreen <- img[,,2]*255 iBlue <- i...
747 sym R (4380 sym/11 pcs) 26 img