https://github.com/cran/QQperm
Raw File
Tip revision: 85f5b5ac1ea4d1bf58604faffcbe813db74efa07 authored by Quanli Wang on 09 October 2016, 09:15:16 UTC
version 1.0.1
Tip revision: 85f5b5a
example.R
library(QQperm)

# load igm data example
data(example.data)

#set number of permutations to generate NULL distribution of P-values
n.permutations <- 100 #too low for real analysis, default value is 1000.

#caclualte expected and observed distributions of P-values using igm data
Ps <- igm.get.pvalues(example.data$data,example.data$is.case,n.permutations)

#write ourput to pdf file only if the R is not running in interactive mode.
if (!interactive()) {
  pdf("QQ_output.pdf")
}

#do qq plot
qqplot(Ps$perm, Ps$observed)

#estimate inflation factor lambda and plot the result
lambda <-estlambda2(Ps$observed,Ps$perm, plot = TRUE, adjust.xy = TRUE)

#write ourput to pdf file only if the R is not running in interactive mode.
if (!interactive()) {
  dev.off()
}

back to top