clmm.CV: Cross Validation with Linear Mixed Models using Gibbs...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This function allows running Cross Validation using clmm. All the formulation is equal to clmm except for the phenotypes, which are being passed as a list of equally sized vectors. The main advantage of the function is that several threads can access the very same data once assigned, which means that the design matrices only have to be allocated once. The parallel scaling of this function is almost linear.

Usage

1
2
clmm.CV(y, X = NULL , random = NULL, par_random = NULL, niter=10000,
burnin=5000,scale_e=0,df_e=-2, verbose = FALSE, seed = NULL)

Arguments

y

list of phenotype vectors

X

Fixed effects design matrix of type: matrix or dgCMatrix. If omitted a column-vector of ones will be assigned

random

list of design matrices for random effects - every element of the list represents one random effect and may be of type: matrix or dgCMatrix

par_random

list of options for random effects. If passed, the list must have as many elements as random. Every element must be a list of 3:

  • scale - scale parameter for the inverse chi-square prior

  • df - degrees of freedom for the inverse chi-square prior

  • method - method to be used for the random effects, may be: random or BayesA

niter

number of iterations

burnin

number of iterations to be discarded as burnin

verbose

prints progress to the screen

scale_e

scale parameter for the inverse chi-square prior for the residuals

df_e

degrees of freedom for the inverse chi-square prior for the residuals

seed

seed for the random number generator. If omitted, a seed will be generated based on machine and time

Details

In C++: For every element of the phenotype list a new instance of an MCMC-object will be created. All the memory allocation needed for running the model is done by the major thread. The function then iterates over all objects and runs the gibbs sampler. This step is parallelized, which means that as many models are being run at the same time as threads available. All MCMC-objects are totally independent from each other, they only share the same design-matrices. Every object has its own random-number generator with its own seed which allows perfectly reproducible results.

Value

List of length(Y) with elements equal to the output of clmm

Author(s)

Claas Heuer

See Also

clmm

Examples

 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
29
30
31
32
33
### Running a 4-fold cross-validation with one repetition:
## Not run: 

# generate random data
rand_data(500,5000)

### compute the list of masked phenotype-vectors for CV
y_CV <- cCV(y,fold=4,reps=1)


### Cross Validation using GBLUP
G.A <- cgrm.A(M,lambda=0.01)


### generate the list of design matrices for clmm
random = list(t(chol(G.A)))

### specify options
par_random = list(list(method="random",scale=var(y)/2,df=5))

### run 
fit <- clmm.CV(y_CV,random=random,par_random=par_random,niter=5000,burnin=2500)

### inspect results
str(fit)

### obtain predictions
pred <- get_pred(fit)

### prediction accuracy
get_cor(pred,y_CV,y)

## End(Not run)

cgenpp documentation built on May 2, 2019, 5:56 p.m.

Related to clmm.CV in cgenpp...