# Which test to calculate the p-value?

so I have a data set of 1500 proteins. I then identify a set of 50 proteins and lets say 40 of these 50 have a certain function. I then draw 1000 random samples of size 50 from my initial 1500 protein data set and look at each sample how many of them have said function. I then get a mean of 27 and a SD of 3 for the 1000 samples.

How do I calculate the p-value to proof that in my set of 50 proteins the proteins with a certain function are over represented (compared to my 100 random samples chosen). I assume that my 1000 sample distribution is Gaussian.

My first thought was that I use a t-test but if I try that R gives me an error that I have to few observations of one variable.

• You should perform the test directly from your distributions. Smth like pnorm(40, mean=27, sd=3). – German Demidov Jun 3 '16 at 13:50
• What do you mean that "R gives me an error that I have to few observations of one variable"? I've never seen such an error, and it doesn't make sense. Can you paste in the code and the error message? – gung - Reinstate Monica Jun 3 '16 at 14:09
• @gung he tries to use t.test on two vectors, and one of the vector has length of 1 (this vector contain single number 40). Another vector contains 1000 of observations =)) > vect <- c(10); vect1 <- rnorm(1000); t.test(vect, vect1) Error in t.test.default(vect, vect1) : not enough 'x' observations – German Demidov Jun 3 '16 at 14:13
• yes i do. thanks german demidov for explaining it better ;) so if i do use the pnorm function, the resulting value i get is the p-value? – user3254126 Jun 3 '16 at 18:24

## 1 Answer

All in all, a t-test on counts seems to be a weird way to approach the problem at hand. Why should anyone assume, counts were Gaussian? They are not. There is a finite number of proteins and you may simply count how many have "said function". By dividing this number by 1500 you get the probability, that any random protein "has said function". The problem is then easily approached by a binomial test.

Let's assume, the probability for any random protein is 68.3% and you have 40 successes in 50 trials, then

binom.test(x=40, n=50, p=0.683)\$p.value [1] 0.0935043

HTH, Bernhard

• Hi thanks for your answer. I don't know either why they did this but I am tasked to reproduce a paper and thats how they did it. Well they only explain that they did as I described above and then they claim to have calculated p values but i dont know how. – user3254126 Jun 3 '16 at 18:18
• @user3254126 What paper are you referring to. Please give a full reference in your question – Glen_b Jun 5 '16 at 11:22