Learn R Programming

AssocTests (version 1.0-1)

smt: Single-marker test

Description

Conduct the single-marker test in an association study to test for the association between the genotype at a biallelic marker and a trait.

Usage

smt(
  y,
  g,
  covariates = NULL,
  min.count = 5,
  missing.rate = 0.2,
  y.continuous = FALSE
)

Arguments

y

a numeric vector of the observed trait values in which the ith element is for the ith subject. The elements could be discrete (0 or 1) or continuous. The missing value is represented by NA.

g

a numeric vector of the observed genotype values (0, 1, or 2 denotes the number of risk alleles) in which the ith element is for the ith subject. The missing value is represented by NA. g has the same length as y.

covariates

an optional data frame, list or environment containing the covariates used in the model. The default is NULL, that is, there are no covariates.

min.count

a critical value to decide which method is used to calculate the p-value when the trait is discrete and covariates = NULL. If the minimum number of the elements given a specific trait value and a specific genotype value is less than min.count, the Fisher's exact test is adopted; otherwise, the Wald test is adopted. The default is 5.

missing.rate

the highest missing value rate of the genotype values that this function can tolerate. The default is 0.2.

y.continuous

logical. If TRUE, y is continuous; otherwise, y is discrete. The default is FALSE.

Value

smt returns a list with class "htest".

If y is continuous, the list contains the following components:

statistic
the observed value of the test statistic.
p.value
the p-value for the test.
alternative
a character string describing the alternative hypothesis.
method
a character string indicating the type of test performed.
data.name
a character string giving the names of the data.
sample.size
a vector giving the numbers of the subjects with the genotypes 0, 1, and 2 (n0,

If y is discrete, the list contains the following components:

statistic
the observed value of the test statistic.
p.value
the p-value for the test.
alternative
a character string describing the alternative hypothesis.
method
a character string indicating the type of test performed.
data.name
a character string giving the names of the data.
sample.size
a vector giving
the number of subjects with the trait value 1 and the genotype 0 (r0),
the number of subjects with the trait value 1 and the genotype 1 (r1),
the number of subjects with the trait value 1 and the genotype 2 (r2),
the number of subjects with the trait value 0 and the genotype 0 (s0),
the number of subjects with the trait value 0 and the genotype 1 (s1),
and the number of subjects with the trait value 0 and the genotype 2 (s2).
bad.obs
a vector giving the number of missing genotype values with the trait value 1
(r.miss), the number of missing genotype values with the trait value 0

Details

Single-marker analysis is a core in many gene-based or pathway-based procedures, such as the truncated p-value combination and the minimal p-value.

References

Lin Wang, Wei Zhang, and Qizhai Li. AssocTests: An R Package for Genetic Association Studies. Journal of Statistical Software. 2020; 94(5): 1-26.

Examples

Run this code
# NOT RUN {
y <- rep(c(0, 1), 25)
g <- sample(c(0, 1, 2), 50, replace = TRUE)
smt(y, g, covariates = NULL, min.count=5,
        missing.rate=0.20, y.continuous = FALSE)
# }

Run the code above in your browser using DataLab