# Measure like relative frequency that also weights the total [closed]

Background
I see a lot of publications mentioning relative frequencies to indicate the presence of certain genes in a specific area. For example:

Location    #Genomes having gene X  #Genomes    Relative frequency (%)
Sand        1                       1           100.00%
Water       10000                   10000       100.00%


I find this 'hard' to interpret as seeing 1 genome having Gene X out of the 1 genomes does not convince me that gene X is often encountered in Sand, whereas seeing it 10000/10000 gives me quite some confidence that Gene X is often present in Water.

Question
What would be the simplest way to give a score (or probability) to consider the relative number of occurrences but also the total number of genomes?

• Relative frequency weighted by the total is back the frequency. Because you did not outline your aims and the context, I consider the question to be "too broad". – ttnphns Jul 16 '19 at 10:27
• Suggest you make a two-by-two table showing counts (not relative frequencies or percentages). Columns: Gene present, Yes or NO. Rows: Sand or Water. Then use a chi-squared analysis or Fisher's exact test. – BruceET Jul 16 '19 at 19:54

Balanced design (1000 of each type): If I toss one coin 1000 times and get 1000 Heads, and I toss another coin 1000 times and get 1 Head, then I am comfortable concluding that the two coins behave differently. The Minitab output from a two-by-two table is as shown below: Both the chi-squared and Fisher tests show a tiny P-value $$< 0.05.$$ (In Minitab, P-values are rounded to three places, so 0.000 means a value less than $$0.0005.)$$

Test and CI for Two Proportions

Sample     X     N  Sample p
1          1  1000  0.001000
2       1000  1000  1.000000

Difference = p (1) - p (2)
Estimate for difference:  -0.999
95% CI for difference:  (-1, -0.997041)
Test for difference = 0 (vs ≠ 0):
Z = -44.68  P-Value = 0.000

* NOTE * The normal approximation may be inaccurate for small samples.

Fisher’s exact test: P-Value = 0.000


Formally, your gene data in Sand and Water follow the same statistical analysis. But for me, the strength of evidence is not the same: Finding a gene is technically harder than seeing whether a coin shows H or T. I would want to be sure that the gene ID procedure works exactly the same for wet and relatively dry specimens. Also, that sampling methods for specimens in sand and water are equivalent.

Unbalanced design (one vs. 1000): Also, it isn't clear from the table how many Sand specimens there are. If it's one in Sand and 1000 in Water (as your last sentence suggests), then neither test shows significance: The chi-squared test can't be completed (because the sample size in Sand is too small) and Fisher's test shows P-value $$1.$$

Test and CI for Two Proportions

Sample     X     N  Sample p
1          1     1  1.000000
2       1000  1000  1.000000

Difference = p (1) - p (2)
Estimate for difference:  0
95% CI for difference:  (*, *)
Test for difference = 0 (vs ≠ 0):
Z = *  P-Value = *

* NOTE * The normal approximation may be inaccurate for small samples.

Fisher’s exact test: P-Value = 1.000


Often, one rejects the null hypothesis that the proportions are equal with a P-value below 5%. However, a P-value near 1 often indicates that the model is wrong or that the data were not collected as described.

• Thankyou @BruceET, sorry for my late response! But this does not give me individual p-values for sand and water this gives me a comparison p-value for the two. I prefer a table where I have, just like with relative frequency, a p-value per observation indicating its significance. Thus for each row in my example (both sand and water) a p-value indicating whether the observed Gene X is significant considering the total number of genomes – KingBoomie Jul 21 '19 at 10:10
• You can get a P-value for sand and a P-value for water only if you are doing two tests. That would mean comparing the sand proportion to some hypothetical proportion. And similarly for water. Without further explanation, your phrase "P-value indicating ... genome." does not say what hypothesis is tested or based on what distribution or standard. Your Question has been put 'on hold' because it lacks a single problem with enough detail to identify an adequate answer. So I am not alone struggling to know what you're asking. Please think about this and clarify. – BruceET Jul 21 '19 at 14:05