Description Usage Arguments Details Value Author(s) References See Also Examples

Test whether each element of x is sampled with the probability specified by the corrsponding element in p.

1 |

`x` |
A boolean vector. |

`p` |
A probability vector having the same length with x. |

`g` |
The group number used in the test. |

`null` |
a character in c('all', 'chi2','boot'). If null=='chi2', then we use (g-1) degree of freedom chi2 distribution to approximately compute p value. If null=='boot', then we use parametric bootstrap to compute p value. If null=='all', then both methods are used. This is the default option. |

`boot` |
The resampling times to compute p value. Only effective when null=='boot' or 'all' |

`info` |
Draw the null distribution of the test statistic. |

`dir` |
The directory to save the plot of the null distribution. |

Null Hypothesis: Each element of x is sampled with a probability which is the corresponding element of p. We group x to g groups according to p. Then we compare the success proportion with the mean value of p in each group.

A list is returned:

`H` |
The test statistic. |

`pval_chi2` |
The p value approximated by using chi2 distribution. |

`pval_boot` |
The p value computed by using parametric bootstrap. |

Wei Jiang, Jing-Hao Xue and Weichuan Yu

Maintainer: Wei Jiang <wjiangaa@connect.ust.hk>

Hosmer, D. W., & Lemesbow, S. (1980). Goodness of fit tests for the multiple logistic regression model. *Communications in statistics-Theory and Methods*, 9(10), 1043-1069.

Jiang, W., Xue, J-H, and Yu, W. What is the probability of replicating a statistically significant association in genome-wide association studies?. *Submitted*.

`RRate`

`repRateEst`

,
`SEest`

,
`repSampleSizeRR`

,
`repSampleSizeRR2`

,

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
alpha<-5e-6 #Significance level in the primary study
alphaR<-5e-3 #Significance level in the replication study
zalpha2<-qnorm(1-alpha/2)
zalphaR2<-qnorm(1-alphaR/2)
##Load data
data('smryStats1') #Example of summary statistics in 1st study
n2.0<-2000 #Number of individuals in control group
n2.1<-2000 #Number of individuals in case group
SE2<-SEest(n2.0, n2.1, smryStats1$F_U, smryStats1$F_A) #SE in replication study
###### RR estimation ######
RRresult<-repRateEst(log(smryStats1$OR),smryStats1$SE, SE2,zalpha2,zalphaR2, output=TRUE,dir='.')
#### Hosmer-Lemeshow test ####
data('smryStats2') #Example of summary statistics in 2nd study
sigIdx<-(smryStats1$P<alpha)
repIdx<-(sign(smryStats1$Z[sigIdx])*smryStats2$Z[sigIdx]>zalphaR2)
groupNum<-10
HLresult<-HLtest(repIdx,RRresult$RR,g=groupNum,dir='.')
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.