assocTest
## S3 method for class 'formula,data.frame':
nullModel(X, y, data,
type=c("automatic", "logistic", "linear", "bernoulli"),
n.resampling=0,
type.resampling=c("bootstrap", "permutation"),
adj=c("automatic", "none", "force"), adjExact=FALSE,
n.resampling.adj=10000, checkData=TRUE)
## S3 method for class 'formula,missing':
nullModel(X, y, data,
type=c("automatic", "logistic", "linear", "bernoulli"),
n.resampling=0,
type.resampling=c("bootstrap", "permutation"),
adj=c("automatic", "none", "force"), adjExact=FALSE,
n.resampling.adj=10000, checkData=TRUE)
## S3 method for class 'matrix,numeric':
nullModel(X, y,
type=c("automatic", "logistic", "linear"), ...)
## S3 method for class 'matrix,factor':
nullModel(X, y,
type=c("automatic", "logistic", "linear"), ...)
## S3 method for class 'missing,numeric':
nullModel(X, y,
type=c("automatic", "logistic", "linear", "bernoulli"),
...)
## S3 method for class 'missing,factor':
nullModel(X, y,
type=c("automatic", "logistic", "linear", "bernoulli"),
...)
y
can be used to
pass a data frame with the table in which both covariates and
traits are contained (alternatively, the data
argument
can be used for that purpose). The other methods (if X
is
not a formula) expect y
to be the trait vector.
Trait vectors can either be numeric vectors or a factor with
two levels (see details below).nullModel
via the data
argument. In this case, the
y
must be empty. If y
is specified, data
is
ignored.FALSE
. This argument
is ignored if small sample correction is not switched on.FALSE
, only a very limited set of input
checks is performed. The purpose of this option is to save
computational effort for repeated input checks if the function is
called from a function that has already performed input checks.
The default is TRUE
.
Only change to FALSE
if you know what you are doing!nullModel
method with signature formula,data.frame
.NullModel
objectX
can be a formula that specifies the trait vector/column, the
covariate matrix/columns (if any), and the intercept (if any).
If neither the y
argument nor the data
argument
is specified, nullModel
searches the environment from
which the function has been called. This interface is largely
analogous to the functions lm
and
glm
.X
argument
is omitted and y
is a numeric vector or factor, y
is
interpreted as trait vector, and a null model is created from
y
without covariates. Linear and logistic models are
trained with an intercept. For type X
argument
is a matrix and y
is a numeric vector or factor, y
is
interpreted as trait vector and X
is interpreted as
covariate matrix. In this case, linear and logistic models are
trained as (generalized) linear regressors that predict the
trait from the covariates plus an intercept. The type
NullModel
y ~ 0
) or by supplying the
trait vector as argument y
while omitting X
.nullModel
method models the relationship
between the trait and the covariates (if any) without taking the genotype
into account, which corresponds to the null assumption that the
trait and the genotype are independent. Therefore, we speak of
null models.
The following types of models are presently
available:
[object Object],[object Object],[object Object]
The type
argument can be used to select the type of model,
where the following restrictions apply:
nullModel
quits
with an error if the trait shows no variation. In other words,
trait vectors that only contain 0's or only contain 1's are not
accepted (as association testings makes little sense for such
traits anyway).Lee, S., Emond, M. J., Bamshad, M. J., Barnes, K. C., Rieder, M. J.,
Nickerson, D. A., NHLBI Exome Sequencing Project - ESP Lung Project
Team, Christiani, D. C., Wurfel, M. M., and Lin, X. (2012)
Optimal unified approach for rare-variant association testing with
application to small-sample case-control whole-exome sequencing studies.
Am. J. Hum. Genet. 91, 224-237. DOI:
NullModel
, lm
,
glm
## 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'
model <- nullModel(y ~ ., pheno)
model
length(model)
residuals(model)
## read phenotype data from CSV file (binary trait + covariates)
phenoFile <- system.file("examples/example1log.csv", package="podkat")
pheno <-read.table(phenoFile, header=TRUE, sep=",")
## train null model with all covariates in data frame 'pheno'
model <- nullModel(y ~ ., pheno)
model
length(model)
residuals(model)
## "train" simple Bernoulli model on a subset of 100 samples
model <- nullModel(y ~ 0, pheno[1:100, ])
model
length(model)
residuals(model)
## alternatively, use the interface that only supplies the
## trait vector
model <- nullModel(y=pheno[1:100, ]$y)
model
Run the code above in your browser using DataLab