qqplot {podkat} | R Documentation

## Quantile-Quantile Plots

### Description

Functions for visualizing association test results by means of a quantile-quantile (Q-Q) plot

### Usage

    ## S4 method for signature 'AssocTestResultRanges,missing'
    qqplot(x, y,
           xlab=deparse(substitute(x)), ylab=deparse(substitute(y)),
           common.scale=TRUE, preserveLabels=FALSE, lwd=1,
           lcol="red", ...)
    ## S4 method for signature 'AssocTestResultRanges,AssocTestResultRanges'
    qqplot(x, y,
           xlab=deparse(substitute(x)), ylab=deparse(substitute(y)),
           common.scale=TRUE, preserveLabels=FALSE, lwd=1,
           lcol="red", ...)

### Arguments

`x,y` | objects of class `AssocTestResultRanges`
`xlab` | if `preserveLabels` is `TRUE`, `xlab` is interpreted as axis label for the horizontal axis; if `preserveLabels` is `FALSE`, `xlab` can be a character string or expression that is interpreted as a name/label for the object `x` and is used for determining an appropriate axis label.
`ylab` | if `preserveLabels` is `TRUE`, `ylab` is interpreted as axis label for the vertical axis; if `preserveLabels` is `FALSE`, `ylab` can be a character string or expression that is interpreted as a name/label for the object `y` and is used for determining an appropriate axis label.
`common.scale` | if `TRUE` (default), the same plotting ranges are used for both axes; if `FALSE`, the two axes are scaled independently.
`preserveLabels` | if `TRUE`, `xlab` and `ylab` are used as axis labels without any change; if `FALSE` (default), the function interprets `xlab` and `ylab` as object labels for `x` and `y` and uses them for determining axis labels appropriately
`lwd` | line width for drawing the diagonal line which theoretically corresponds to the equality of the two distributions; if zero, no diagonal line is drawn.
`lcol` | color for drawing the diagonal line
`...` | all other arguments are passed to `plot`;

### Details

If `qqplot` is called for an `AssocTestResultRanges` object without specifying the second argument `y`, a Q-Q plot of the raw p-values in `x` against a uniform distribution of expected p-values is created, where the theoretical p-values are computed using the `ppoints` function. In this case, the log-transformed observed p-values contained in `x` are plotted on the vertical axis and the log-transformed expected p-values are plotted on the horizontal axis. If `preserveLabels` is `TRUE`, `xlab` and `ylab` are used as axis labels as usual. However, if `preserveLabels` is `FALSE`, which is the default, `xlab` is interpreted as object label for `x`, i.e. the object whose p-values are plotted on the vertical axis.

If `qqplot` is called for two `AssocTestResultRanges` object `x` and `y`, the log-transformed raw p-values of `x` and `y` are plotted against each other, where the p-values of `x` are plotted on the horizontal axis and the p-values of `x` are plotted on the vertical axis.

### Value

like the standard `qqplot` function from the stats package, `qqplot` returns an invisible list containing the two sorted vectors of p-values.

### Author(s)

Ulrich Bodenhofer bodenhofer@bioinf.jku.at

### References

http://www.bioinf.jku.at/software/podkat

### See Also

`AssocTestResultRanges`

### Examples

    ## load genome description
    data(hgA)

    ## partition genome into overlapping windows
    windows <- partitionRegions(hgA)

    ## load genotype data from VCF file
    vcfFile <- system.file("examples/example1.vcf.gz", package="podkat")
    Z <- readGenotypeMatrix(vcfFile)

    ## read phenotype data from CSV file (continuous trait + covariates)
    phenoFile <- system.file("examples/example1lin.csv", package="podkat")
    pheno <-read.table(phenoFile, header=TRUE, sep=",")

    ## train null model with all covariates in data frame 'pheno'
    nm.lin <- nullModel(y ~ ., pheno)

    ## perform association tests
    res.p <- assocTest(Z, nm.lin, windows, kernel="linear.podkat")
    res.s <- assocTest(Z, nm.lin, windows, kernel="linear.SKAT")

    ## plot results
    qqplot(res.p)
    qqplot(res.p, res.s, xlab="PODKAT results", ylab="SKAT results")
    qqplot(res.p, res.s, xlab="PODKAT results", ylab="SKAT results",
           preserveLabels=TRUE)
    qqplot(res.p, res.s, common.scale=FALSE)

[Package podkat version 1.22.0 Index]