# How to calculate if two samples data are similar

I'm not sure if a test exists to ask the question I'm looking for but I have some data and an expected set of data that looks something like this:

Expected:
Gene 1 7
Gene 2 3
Gene 5 4
Gene 7 1

Experimental:
Gene 1 4
Gene 2 4
Gene 8 2
Gene 10 1


Generally, I would like to ask if the actual data and the expected look similar, but I have a couple of problems:

1) Is there a way to test similarity?

2) In reality I'm working with genomic data, and the expected are affected genes, meaning the pool is ~30k different genes, and 7 times Gene 1was affected.

### Edit:

As the above explanation seems to be a bit confusing here is some further explanation that hopefully helps to clarify.

The expected data is taken from a group of patients which had mutated or 'broken' genes. In this group 7 people had Gene 1 affected and within 3 people Gene 2 was affected, etc.

In my experimental group I have a different group of patients and I would like to know if the distribution of their affected genes looks similar to that of the original patient population. And to address one of the comments below, the numbers do not necessarily have to add up to the same total as any number of genes may be affected in a given patient. Furthermore, there are about 30k genes in a human and roughly any number of these may be affected, though in my observations only a fraction are.

• Expected counts (if that's what they are) add to 15, while observed counts add to 11. How does that make sense? – BruceET Apr 15 at 23:05
• You can't test it until you define what you mean by it (how you are going to measure it) – Glen_b -Reinstate Monica Apr 16 at 3:51
• @BruceET Do the edits help to clarify? – The Nightman Apr 16 at 18:50

Maybe the header 'Expected' should be 'Control'. Also the genes in common are '1' and '2', so maybe a table suitable for a chi-squared test of homogeneity would be as follows:

Gene    Ctrl  Expt
1      7     4
2      3     4
Other     5     3


However, the counts are too small for us to be sure that the "chi-squared" statistic really has a chi-squared distribution. In any case, there does not seem to be a significant difference between 'Ctrl and 'Expt' groups based on so little data.

ctrl = c(7,3,5); expt = c(4,4,3)
chisq.test(ctrl, expt)

Pearson's Chi-squared test

data:  ctrl and expt
X-squared = 3, df = 2, p-value = 0.2231

Warning message:
In chisq.test(ctrl, expt) :
Chi-squared approximation may be incorrect
`