View source: R/vc_score_perm.R
| vc_score_perm | R Documentation | 
This function computes an approximation of the Variance Component test for a
mixture of χ^{2}s using Davies method from davies
vc_score_perm( y, x, indiv, phi, w, Sigma_xi = diag(ncol(phi)), na_rm = FALSE, n_perm = 1000, progressbar = TRUE, parallel_comp = TRUE, nb_cores = parallel::detectCores() - 1 )
y | 
 a numeric matrix of dim   | 
x | 
 a numeric design matrix of dim   | 
indiv | 
 a vector of length   | 
phi | 
 a numeric design matrix of size   | 
w | 
 a vector of length   | 
Sigma_xi | 
 a matrix of size   | 
na_rm | 
 logical: should missing values (including   | 
n_perm | 
 the number of permutation to perform. Default is   | 
progressbar | 
 logical indicating whether a progress bar should be displayed when computing permutations (only in interactive mode).  | 
parallel_comp | 
 a logical flag indicating whether parallel computation
should be enabled. Only Linux and MacOS are supported, this is ignored on Windows.
Default is   | 
nb_cores | 
 an integer indicating the number of cores to be used when
  | 
A list with the following elements:
score: an approximation of the observed set score
scores_perm: a vector containing the permuted set scores
gene_scores_unscaled: approximation of the individual gene scores
gene_scores_unscaled_perm: a list of approximation of the permuted individual gene scores
davies
#rm(list=ls())
set.seed(123)
##generate some fake data
########################
n <- 100
r <- 12
t <- matrix(rep(1:3), r/3, ncol=1, nrow=r)
sigma <- 0.4
b0 <- 1
#under the null:
b1 <- 0
#under the alternative:
b1 <- 0.7
y.tilde <- b0 + b1*t + rnorm(r, sd = sigma)
y <- t(matrix(rnorm(n*r, sd = sqrt(sigma*abs(y.tilde))), ncol=n, nrow=r) +
      matrix(rep(y.tilde, n), ncol=n, nrow=r))
x <- matrix(1, ncol=1, nrow=r)
#run test
scoreTest <- vc_score_perm(y, x, phi=t, w=matrix(1, ncol=ncol(y), nrow=nrow(y)),
                    Sigma_xi=matrix(1), indiv=rep(1:(r/3), each=3), parallel_comp = FALSE)
scoreTest$score
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.