[Genabel-commits] r1181 - in pkg/GenABEL: . R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Apr 4 10:48:56 CEST 2013
Author: yurii
Date: 2013-04-04 10:48:56 +0200 (Thu, 04 Apr 2013)
New Revision: 1181
Modified:
pkg/GenABEL/R/egscore.R
pkg/GenABEL/generate_documentation.R
Log:
converted egscore documentation to roxygen format
Modified: pkg/GenABEL/R/egscore.R
===================================================================
--- pkg/GenABEL/R/egscore.R 2013-04-04 08:40:16 UTC (rev 1180)
+++ pkg/GenABEL/R/egscore.R 2013-04-04 08:48:56 UTC (rev 1181)
@@ -1,3 +1,71 @@
+#' Fast score test for association, corrected with PC
+#'
+#' Fast score test for association between a trait and genetic polymorphism,
+#' adjusted for possible stratification by principal components.
+#'
+#' The idea of this test is to use genomic kinship matrix to first, derive axes
+#' of genetic variation (principal components), and, second, adjust both trait
+#' and genotypes onto these axes. Note that the diagonal of the kinship matrix
+#' should be replaced (default it is .5+F, and for EIGENSTRAT one needs
+#' variance). These variances are porduced by \code{\link{hom}} function (see
+#' example).
+#'
+#' The traits is first analysed using LM and with covariates as specified with
+#' formula and also with axes of variation as predictors. Corrected genotypes
+#' are defined as residuals from regression of genotypes onto axes (which are
+#' orthogonal). Correlaton between corrected genotypes and phenotype is
+#' computed, and test statistics is defined as square of this correlation times
+#' (N - K - 1), where N is number of genotyped subjects and K is the number of
+#' axes.
+#'
+#' This test is defined only for 1 d.f.
+#'
+#' @param formula Formula describing fixed effects to be used in analysis, e.g.
+#' y ~ a + b means that outcome (y) depends on two covariates, a and b. If no
+#' covariates used in analysis, skip the right-hand side of the equation.
+#' @param data An object of \code{\link{gwaa.data-class}}
+#' @param snpsubset Index, character or logical vector with subset of SNPs to
+#' run analysis on. If missing, all SNPs from \code{data} are used for
+#' analysis.
+#' @param idsubset Index, character or logical vector with subset of IDs to run
+#' analysis on. If missing, all people from \code{data/cc} are used for
+#' analysis.
+#' @param kinship.matrix kinship matrix, as returned by \code{\link{ibs}}, Use
+#' weight="freq" with \code{\link{ibs}} and do not forget to repalce the
+#' diagonal with Var returned by \code{\link{hom}}, as shown in example!
+#' @param naxes Number of axes of variation to be used in adjustment (should be
+#' much smaller than number of subjects)
+#' @param strata Stratification variable. If provieded, scores are computed
+#' within strata and then added up.
+#' @param times If more then one, the number of replicas to be used in
+#' derivation of empirical genome-wide significance.
+#' @param quiet do not print warning messages
+#' @param bcast If the argument times > 1, progress is reported once in bcast
+#' replicas
+#' @param clambda If inflation facot Lambda is estimated as lower then one,
+#' this parameter controls if the original P1df (clambda=TRUE) to be reported
+#' in Pc1df, or the original 1df statistics is to be multiplied onto this
+#' "deflation" factor (clambda=FALSE). If a numeric value is provided, it is
+#' used as a correction factor.
+#' @param propPs proportion of non-corrected P-values used to estimate the
+#' inflation factor Lambda, passed directly to the \code{\link{estlambda}}
+#' @return Object of class \code{\link{scan.gwaa-class}}
+#' @author Yurii Aulchenko
+#' @seealso \code{\link{qtscore}}, \code{\link{mmscore}}, \code{\link{ibs}},
+#' \code{\link{scan.gwaa-class}}
+#' @references Price A. L. et al, Principal components analysis corrects for
+#' stratification in genome-wide association studies. Nat Genet 38: 904-909.
+#' @keywords htest
+#' @examples
+#'
+#' data(ge03d2c)
+#' #egscore with stratification
+#' gkin <- ibs(ge03d2c[,autosomal(ge03d2c)],w="freq")
+#' #replace the diagonal with right elements
+#' diag(gkin) <- hom(ge03d2c[,autosomal(ge03d2c)])$Var
+#' a <- egscore(dm2~sex+age,data=ge03d2c,kin=gkin)
+#' plot(a,df="Pc1df")
+#'
"egscore" <-
function(formula,data,snpsubset,idsubset,kinship.matrix,naxes=3,strata,
times=1,quiet=FALSE,bcast=10,clambda=TRUE,propPs=1.0) {
Modified: pkg/GenABEL/generate_documentation.R
===================================================================
--- pkg/GenABEL/generate_documentation.R 2013-04-04 08:40:16 UTC (rev 1180)
+++ pkg/GenABEL/generate_documentation.R 2013-04-04 08:48:56 UTC (rev 1181)
@@ -5,6 +5,7 @@
"blurGenotype.R",
"checkPackageVersionOnCRAN.R",
"del.phdata.R",
+ "egscore.R",
"estlambda.R",
"export.plink.R",
"extract.annotation.impute.R",
More information about the Genabel-commits
mailing list