fit.zqtl.vanilla.Rd
Inference of zQTL regression without multivariate effect size.
fit.zqtl.vanilla(effect, effect.se, X, multi.C, univar.C)
Marginal effect size matrix (SNP x trait)
Marginal effect size standard error matrix (SNP x trait)
Design matrix (reference Ind x SNP)
sample size of actual data (will ignore if n = 0)
multivariate SNP annotations (SNP x something; default: NULL)
univariate SNP annotations (SNP x something; default: NULL)
A list of inference/optimization options.
Hyper parameter tuning (default: FALSE)
Rescale z-scores by standard deviation (default: FALSE)
Fixed value of tau
Fixed value of pi
Lower-bound of tau (default: -10)
Upper-bound of tau (default: -4)
Lower-bound of pi (default: -4)
Upper-bound of pi (default: -1)
Convergence criterion (default: 1e-4)
Maximum precision (default: 1000)
Update rate (default: 1e-2)
Update rate decay (default: 0)
SD of random jitter for mediation & factorization (default: 0.1)
Number of stochastic samples (default: 10)
Number of variational Bayes iterations (default: 2000)
Verbosity (default: TRUE)
Printing interval (default: 10)
Number of threads during calculation (default: 1)
Error tolerance in Eigen decomposition (default: 0.01)
Regularization of Eigen decomposition (default: 0.0)
Standardize (default: TRUE)
estimate residual z-scores (default: FALSE)
variance calculation (default: FALSE)
Scaled variance calculation (default: FALSE)
Number of bootstraps (default: 0)
Number of bootstraps for variance estimation (default: 100)
Minimum level of SE (default: 1e-4)
Random seed
a list of variational inference results.
conf.multi: association with multivariate confounding variables
conf.uni: association with univariate confounding variables
resid: residuals
gwas.clean: cleansed version of univariate GWAS effects
var: variance decomposition results
llik: log-likelihood trace over the optimization
n = 500
p = 2000
m = 1
set.seed(1)
.rnorm <- function(a, b) matrix(rnorm(a * b), a, b)
X = .rnorm(n, p)
Y = matrix(0, n, m)
h2 = 0.25
y1 = X[, 1:500] %*% .rnorm(500, 1) * sqrt(h2/500)
y0 = .rnorm(n, 1) * sqrt(1 - h2)
Y = y1 + y0
qtl.tab = calc.qtl.stat(X, Y)
qtl.1.tab = calc.qtl.stat(X, y1)
z.1 = matrix(qtl.1.tab$beta/qtl.1.tab$se, ncol = 1)
qtl.0.tab = calc.qtl.stat(X[sample(n), , drop = FALSE], y1)
z.0 = matrix(qtl.0.tab$beta/qtl.0.tab$se, ncol = 1)
z.out = fit.zqtl.vanilla(matrix(qtl.tab$beta, ncol=1),
matrix(qtl.tab$se, ncol=1),
X = X,
univar.C = cbind(z.1, z.0),
do.var.calc = TRUE,
scale.var = TRUE,
nboot.var = 100)
library(dplyr)
.make.df <- function(x) {
data.frame(mean = x$mean, sd = x$sd)
}
.power10 <- function(x, component) {
take.var.power10(x) %>%
.make.df() %>%
mutate(component)
}
var.tab = bind_rows(.power10(z.out$var$univar.tot, 'univar.tot'),
.power10(z.out$var$multivar.tot, 'multivar.tot'),
.power10(z.out$var$resid, 'resid'),
.power10(z.out$var$univar, 'univar'))
print(var.tab)
#> mean sd component
#> 1 2.622431e-01 4.953439e-03 univar.tot
#> 2 8.132623e-10 8.883874e-11 multivar.tot
#> 3 4.714143e-01 1.143686e-03 resid
#> 4 2.537794e-01 5.254870e-02 univar
#> 5 1.870377e-06 3.389168e-06 univar