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
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(snpStats)
Loading required package: survival
Loading required package: Matrix
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/snpStats/chi.squared.Rd_%03d_medium.png", width=480, height=480)
> ### Name: chi.squared
> ### Title: Extract test statistics and p-values
> ### Aliases: chi.squared deg.freedom effect.sign p.value sample.size
> ### effective.sample.size
> ### Keywords: utilities
>
> ### ** Examples
>
> data(testdata)
> tests <- single.snp.tests(cc, stratum=region, data=subject.data,
+ snp.data=Autosomes, snp.subset=1:10)
> chi.squared(tests, 1)
173760 173761 173762 173767 173769 173770 173772
1.00000000 1.42532140 1.87283271 0.75765548 2.87726991 NA 1.08695652
173774 173775 173776
0.65081636 0.94559292 0.09630493
> p.value(tests, 1)
173760 173761 173762 173767 173769 173770 173772
0.31731051 0.23252951 0.17115100 0.38406323 0.08983822 NA 0.29714653
173774 173775 173776
0.41982096 0.33084363 0.75630975
>
>
>
>
>
> dev.off()
null device
1
>