Learn R Programming

ssa (version 1.3.0)

prs.train: Polygenic risk score (given only allele frequencies); training

Description

Equivalent to maximum likelihood naive Bayes classifier. The discriminant function is $$\sum_j\hat{\beta}_jX_j,$$ where \(X_j\) is the additively coded genotype of SNP j.

Usage

prs.train(pi0, pi1, n0, n1)

Arguments

pi0, pi1

p x 1 vectors of control and case minor allele frequencies, respectively; IMPORTANT: must be relative to the same allele in both cases and controls

n0, n1

number of controls and number of cases, respectively

Value

pi0

minor allele frequencies in controls

pi1

minor allele frequencies in cases

P

proportion of cases

Examples

Run this code
# NOT RUN {
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(colMeans(X0)/2,colMeans(X1)/2,n0,n1);

# }

Run the code above in your browser using DataLab