Description Usage Arguments Value Examples
Uses CV to select how many SNPs to include. SNPs are ordered by the magnitude of their estimated (ang possibly weighted) allelic log-odds ratio. The discriminant function is
∑_j\hat{β}_jI≤ft(≤ft\vert\frac{\hat{β}_j}{w_j}\right\vert>λ\right)X_j,
where X_j is the additively coded genotype of SNP j.
1 | prs.train.cv(X0, X1, K = 3, w = 1, nlambda = 100, verbose = FALSE)
|
X0, X1 |
n x p vectors of control and case genotypes, additively coded; IMPORTANT: coding must be relative to the same allele in both cases and controls |
K |
number of folds for CV |
w |
p x 1 weight vector |
nlambda |
number of thresholds to tune over |
verbose |
if TRUE, report current fold of CV |
pi0 |
minor allele frequencies in controls of kept SNPs |
pi1 |
minor allele frequencies in cases of kept SNPs |
w |
weight vector for kept SNPs |
lambda |
lambda cutoff |
P |
proportion of cases |
1 2 3 4 5 6 7 8 9 10 11 | p <- 1000; ## number of snps
I <- rep(0,p); I[1:10] <- 1; ## which snps are causal
set.seed(1); pi0 <- runif(p,0.1,0.5); ## control minor allele frequencies
set.seed(1); ors <- runif(sum(I),-1,1); ## odds ratios
pi1 <- pi0;
pi1[I==1] <- expit(ors+logit(pi0[I==1]));
n0 <- 100; ## number of controls
X0 <- t(replicate(n0,rbinom(p,2,pi0))); ## controls
n1 <- 50; ## number of cases
X1 <- t(replicate(n1,rbinom(p,2,pi1))); ## cases
prs.train.cv(X0,X1,K=3,w=1,nlambda=100,verbose=TRUE);
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.