This file contains an R function to obtain empirical Bayes type shrinkage estimates of SNP effects. To use this function, copy these commands to a file – named, for example, mycode.r.
In R, using the default STATS library, first read in the cognitive outcome (call it y) and the SNP data and any confounders or adjustment factors of interest (call it x; organize x such that the first n.confounders columns are the confounders or adjustment variables of interest; see comments given at the top of code below). Also read in the weight matrix (call it w.mat).
Let my.nc denote the number of confounders or adjustment variables.
Read in the code using the command: source(“mycode.r”)
Next, get the desired shrinkage estimates by running the command:
my.est <- get.eb.est(y, x, w.mat, my.nc)
The shrinkage estimates are given in my.est$estimates$eb.ex.est, and the variances are given in my.est$variances$eb.ex.var
NOTE: It is assumed that the user has working knowledge of the R programming language.