# Method of graphical visualization of the difference between two groups based on ratio

I would like to know what would be nicest way to graphically visualize the difference between two populations by comparing different aspects. Let's say that we have two populations:

Group 1 - 200 people

Group 2 - 200 people

From both group we take 10 people. People are paired by the name within the groups, so for example I took Mark from Group 1 and was looking if there is a Mark in the second group. There was so they can be taken to the comparison. I kept doing that until I get a group of 10 people from each group. I managed to create 5 different groups like that and I used them for specific comparisons:

First group to be compared - height:

Mark 1 vs Mark 2 = 183 cm vs 175 cm, ratio = 1,045

Next 1 vs Next 2 = --------||-----------

Next 1 vs Next 2 = --------||-----------

Next 1 vs Next 2 = --------||-----------

Next 1 vs Next 2 = --------||-----------

... till 10.

Second group to be compared - weight

Tim 1 vs Tim 2 = 88 kg vs 67 kg, ratio = 1,31

Next 1 vs Next 2 = --------||-----------

Next 1 vs Next 2 = --------||-----------

Next 1 vs Next 2 = --------||-----------

Next 1 vs Next 2 = --------||-----------

Next 1 vs Next 2 = --------||-----------

.... till 10

and 3 more comparisons.

I would like to know how I can visualize such analysis. The idea is to show that there are some statistical differences between the groups. I did 4 replicates for real data and I am planning to perform t.test to verify the data. I am looking for a nice way to present my results.

Any ideas ? I would like to perform analysis in R so would be nice it would be "doable" in this software.

Let's simulate some data:

set.seed(1)
ratios <- list(
height=rnorm(10,1.1,.1),
weight=rnorm(10,1,.1),
thrombozyte.count=rnorm(10,1,.2),
hair.length=rnorm(10,1.3,.3),
shoe.size=rnorm(10,0.9,.1))


I used a list instead of a matrix to accommodate potentially different numbers of observations in each dimension. You could of course also use a straightforward matrix.

Now, your ratios are comparable - being ratios, they are all on the same scale. So I personally would recommend a simple dot plot for your five dimensions:

plot(c(0.5,length(ratios)+0.5),range(unlist(ratios)),
type="n",xaxt="n",main="Ratios",xlab="",ylab="")
for ( ii in seq_along(ratios) ) {
points(rep(ii,length(ratios[[ii]])),ratios[[ii]],pch=19)
}
abline(h=1,lty=2)
axis(1,seq_along(ratios),names(ratios))


Alternatively, if you have more than ten observations in each dimension, you could use beanplots, and/or jitter the dots horizontally so they are more easily distinguished:

library(beanplot)
plot(c(0.5,length(ratios)+0.5),range(unlist(ratios)),
type="n",xaxt="n",main="Ratios",xlab="",ylab="")
for ( ii in seq_along(ratios) ) {
points(runif(length(ratios[[ii]]),ii-0.1,ii+0.1),ratios[[ii]],pch=19)
}
abline(h=1,lty=2)
axis(1,seq_along(ratios),names(ratios))


Note that I am only addressing your visualization questions. I'm not entirely sure what you mean by "I did 4 replicates for real data and I am planning to perform to verify the data", but whether your envisaged analysis is valid would be a separate question.

Lets simulate 2 groups, both are assumed to be normally distributed:

set.seed( 222)
h1 <- rnorm(10,1.1,.1)

set.seed( 713)
h2 <- rnorm(10, 2 ,.2)


You could use a KS test to run a quick and simple check to see if the samples came from different populations. It doesn't make any assumptions about the distribution or its parameters:

ks.test( h1, h2)

Two-sample Kolmogorov-Smirnov test

data:  h1 and h2
D = 1, p-value = 1.083e-05
alternative hypothesis: two-sided


For visualization, apart from the box-plot, violin-plots, and scatter plots such as the ones Stephen mentioned in his answer, you could also plot the cumulative density of these two groups against each other.