Description Usage Arguments Value Examples
View source: R/FastLORS_Functions.R
LORSscreen
LORSscreen
is a function to solve the LORS-Screening optimization problem in Yang et al. (2013)
1 | LORSscreen(Y, X, lambda, tol)
|
Y |
gene expression matrix |
X |
a SNP |
lambda |
tuning parameter |
tol |
a tolerance level |
B the estimated coefficients for the SNP
L the estimated hidden factors
mu the estimate for the intercept
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ##Example
## Generate some data
n <- 50
p <- 200
q <- 100
k <- 10
set.seed(123)
X <- matrix(rbinom(n*p,1,0.5),n,p)
L <- matrix(rnorm(n*k),n,k) %*% t(matrix(rnorm(q*k),q,k))
B <- matrix(0, ncol(X), ncol(L))
activeSNPs <- sort(sample(c(1:nrow(B)), 20))
for(i in 1:length(activeSNPs)){
genes_influenced <- sort(sample(c(1:ncol(B)),5))
B[activeSNPs[i], genes_influenced] <- 2
}
E <- matrix(rnorm(n*q),n,q)
Y <- X %*% B + L + E
## Usage to build initial estimate
Bhat_initial <- c()
for(SNP_col in 1:ncol(X)){
X1 <- matrix(X[,SNP_col], ncol = 1)
LS <- LORSscreen(Y, X1, lambda = 0.1, 0.01)
B_row <- LS$B
Bhat_initial <- rbind(Bhat_initial, B_row)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.