chi.squared {snpStats} | R Documentation

## Extract test statistics and p-values

### Description

Generic functions to extract values from the SNP association test objects returned by various testing functions

### Usage

    chi.squared(x, df)
    deg.freedom(x)
    effect.sign(x, simplify)
    p.value(x, df)
    sample.size(x)
    effective.sample.size(x)

### Arguments

`x` | An object of class `"SingleSnpTests"`, `"SingleSnpTestsScore"`, or `"GlmTests"`
`df` | Either the numeric value 1 or 2 (not used when `x` is of class `"GlmTests"`)
`simplify` | This switch is relevant when `x` is of class `"GlmTests"` and plays the same role as it does in `sapply`. If `simplify=TRUE`, where possible the output is returned as a simple numeric vector rather than as a list

### Details

These functions operate on objects created by `single.snp.tests`, `snp.lhs.tests`, and `snp.lhs.tests`.

The functions `chi.squared` and `p.value` return the chi-squared statistic and the corresponding p-value. The argument `df` is only used for output from `single.snp.tests`, since this function calculates both 1 df and 2 df tests for each SNP. The functions `snp.lhs.tests` and `snp.rhs.tests` potentially calculate chi-squared tests on varying degrees of freedom, which can be extracted with `deg.freedom`. The function `effect.sign` indicates the direction of associations. When applied to an output object from `snp.single.tests`, it returns `+1` if the association, as measured by the 1 df test, is positive and `-1` if the association is negative. Each test calculated by `GlmTests` are potentially tests of several parameters so that the effect sign can be a vector. Thus `effect.sign` returns a list of sign vectors unless, if `simplify=TRUE`, and it can be simplified as a single vector with one sign for each test. The function `sample.size` returns the number of observations actually used in the test, after exclusions due to missing data have been applied, and `effective.sample.size` returns the effective sample size which is less than the true sample size for tests on imperfectly imputed SNPs.

### Value

A numeric vector containing the chi-squared test statistics or p-values. The output vector has a `names` attribute.

### Note

The `df` and `simplify` arguments are not always required (or legal). See above

### Author(s)

David Clayton dc208@cam.ac.uk

### See Also

`single.snp.tests`, `snp.lhs.tests`, `snp.rhs.tests`, `SingleSnpTests-class`, `SingleSnpTestsScore-class`, `GlmTests-class`

### Examples

    data(testdata)
    tests <- single.snp.tests(cc, stratum=region, data=subject.data,
       snp.data=Autosomes, snp.subset=1:10)
    chi.squared(tests, 1)
    p.value(tests, 1)

[Package snpStats version 1.40.0 Index]