score.fixed.linear/score.fixed.logistic | R Documentation |
Score Test for association between covariates and phenotype.
score.fixed.linear(x, Y, X = matrix(1, length(Y)), K, ...)
score.fixed.logistic(x, Y, X = matrix(1, length(Y)), K, ...)
x |
A matrix of covariates |
Y |
The phenotype vector |
X |
A covariable matrix. The default is a column vector of ones, to include an intercept in the model |
K |
A positive definite matrix or a |
... |
Optional arguments used to fit null model in |
The function score.fixed.linear
considers the linear mixed model
Y = X\alpha + x\beta + \omega_1 + \ldots + \omega_k + \varepsilon
whereas the score.fixed.logistic
function considers the following logistic model
\mbox{logit}(P[Y=1|X,x,\omega_1,\ldots,\omega_k]) = X\alpha + x\beta + \omega_1 + \ldots + \omega_k
with \omega_j \sim N(0,\tau_j K_j)
where K_j
are Genetic Relationship Matrix (GRM), \varepsilon \sim N(0,\sigma^2 I_n)
and fixed effects \alpha
and \beta
.
The two functions give score test for
H_0
: \beta=0
vs H_1
: \beta\neq 0
.
In this aim, all parameters under null model are estimated with lmm.aireml
or logistic.mm.aireml
.
A named list of values:
score |
Estimated score |
p |
The corresponding p-value |
log.p |
The logarithm of corresponding p-value |
Hervé Perdry and Claire Dandine-Roulland
lmm.aireml
, logistic.mm.aireml
# Load data
data(AGT)
x <- as.bed.matrix(AGT.gen, AGT.fam, AGT.bim)
standardize(x) <- "p"
# Calculate GRM et its eigen decomposition
k <- GRM(x)
eig <- eigen(k)
eig$values <- round(eig$values, 5)
# generate covariate matrix
set.seed(1)
X <- cbind( rbinom(nrow(x), 1, prob=1/2), rnorm(nrow(x)) )
# simulate quantitative phenotype with polygenic component and covariate effects
y <- X %*% c(-1,0.5) + lmm.simu(0.3,1,eigenK=eig)$y
t <- score.fixed.linear(X, y, K=k, verbose=FALSE)
str(t)
# simulate binary phenotype with polygenic component and covariate effects
mu <- X %*% c(-1,0.5) + lmm.simu(1, 0, eigenK=eig)$y
pi <- 1/(1+exp(-mu))
y <- 1*( runif(length(pi))<pi )
tt <- score.fixed.logistic(X, y, K=k, verbose=FALSE)
str(tt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.