본문 바로가기

R관련

proportion test

728x90
반응형

The two-proportions z-test is used to compare two observed proportions. This article describes the basics of two-proportions *z-test and provides pratical examples using R sfoftware


-Proteogenomic characterization of human EOGC _cancercell 2019


For the seven shared significantly mutated genes from TCGA and HK cohorts and MUC5B and BANP from our cohort, we compared nonsynonymous somatic SNV frequencies in our EOGCs with those in previous LOGCs in the following three groups ofGCs enriched in our cohort: diffuse, microsatellite stable (MSS), and EBV-negative GCs (74, 76, and 74 of 80 GCs, respectively). In diffuse GCs, BANP and MUC5B showed higher mutation rates in our EOGCs than in LOGCs of TCGA and HK cohorts (Figure 1B). 



사용할 때는 다음의 질문에 사용되는 것임

For example, we have two groups of individuals:

  • Group A with lung cancer: n = 500
  • Group B, healthy individuals: n = 500

The number of smokers in each group is as follow:

  • Group A with lung cancer: n = 500, 490 smokers, pA=490/500=98
  • Group B, healthy individuals: n = 500, 400 smokers, pB=400/500=80

In this setting:

  • The overall proportion of smokers is p=frac(490+400)500+500=89
  • The overall proportion of non-smokers is 


  1. whether the observed proportion of smokers in group A (pA) is equal to the observed proportion of smokers in group (pB)?
  2. whether the observed proportion of smokers in group A (pA) is less than the observed proportion of smokers in group (pB)?
  3. whether the observed proportion of smokers in group A (pA) is greater than the observed proportion of smokers in group (pB)?


R function은 다음임

prop.test(x, n, p = NULL, alternative = "two.sided",correct = TRUE)

Note that, by default, the function prop.test() used the Yates continuity correction, which is really important if either the expected successes or failures is < 5. If you don’t want the correction, use the additional argument correct = FALSEin prop.test() function. The default value is TRUE. (This option must be set to FALSE to make the test mathematically equivalent to the uncorrected z-test of a proportion.)

res <- prop.test(x = c(490, 400), n = c(500, 500))


http://www.sthda.com/english/wiki/two-proportions-z-test-in-r

728x90
반응형

'R관련' 카테고리의 다른 글

calculate GSEA Enrichment score  (0) 2019.02.13
Color scale bar function  (0) 2019.01.25
DLL 관련 해결법  (0) 2018.06.29
microarray (affymetrix, illumina)  (0) 2018.03.28
GEOquery, microarray, getGEO  (0) 2018.03.02