matrixQTL_two_dim: Solve Y = X1 b1 + X2 b2 + e in matrix form

Description Usage Arguments Value Examples

View source: R/rlib_matrix_ls.R

Description

For each column i in X, solve Y_k = X_1i b_1i + X_2i b_2i + e as least squares problem and output estimated effect size and standard deviation

Usage

1
matrixQTL_two_dim(Y, X1, X2, n)

Arguments

Y

response to regress against (dimension = N x K)

X1

P predictors (as the first predictor) to perform regression separately (dimension = N x P)

X2

P predictors (as the second predictor) to perform regression separately (dimension = N x P)

n

sample size (dimension = P x K)

Value

a list of summary statistics beta1_hat: estimated b1, b1_hat (dimension = K x P) beta1_se: standard deviation of b1_hat (dimension = K x P) beta2_hat: estimated b2, b2_hat (dimension = K x P) beta2_se: standard deviation of b2_hat (dimension = K x P)

Examples

1
2
3
4
5
6
matrixQTL_two_dim(
  Y = matrix(rnorm(100), ncol = 3),
  X1 = matrix(sample(c(0, 0.5, 1), 200, replace = TRUE), ncol = 2),
  X2 = matrix(sample(c(0, 0.5, 1), 200, replace = TRUE), ncol = 2),
  n = matrix(200, ncol = 2, nrow = 3)
)

liangyy/mixqtl documentation built on Sept. 17, 2020, 11:36 a.m.