# 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

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