LDpred2: better, faster, stronger By Florian Privé, Julyan Arbel, Bjarni J Vilhjálmsson, Russell Schwartz Published in: Bioinformatics DOI: 10.1093/bioinformatics/btaa1029 ABSTRACT Abstract Motivation Polygenic scores have become a central tool in human genetics research. LDpred is a popular method for deriving polygenic scores based on summary statistics and a matrix of correlation between genetic variants. However, LDpred has limitations that may reduce its predictive performance. Results Here, we present LDpred2, a new version of LDpred that addresses these issues. We also provide two new options in LDpred2: a ‘sparse’ option that can learn effects that are exactly 0, and an ‘auto’ option that directly learns the two LDpred parameters from data. We benchmark predictive performance of LDpred2 against the previous version on simulated and real data, demonstrating substantial improvements in robustness and predictive accuracy compared to LDpred1. We then show that LDpred2 also outperforms other polygenic score methods recently developed, with a mean AUC over the 8 real traits analyzed here of 65.1%, compared to 63.8% for lassosum, 62.9% for PRS-CS and 61.5% for SBayesR. Note that LDpred2 provides more accurate polygenic scores when run genome-wide, instead of per chromosome. Availability and implementation LDpred2 is implemented in R package bigsnpr. Supplementary information Supplementary data are available at Bioinformatics online. 1 INTRODUCTION In recent years, the use of polygenic scores (PGS) has become widespread. A PGS aggregates (risk) effects across many genetic variants into a single predictive score. These scores have proven useful for studying the genetic architecture and relationships between diseases and traits (Kong et al., 2018; Purcell et al., 2009). Moreover, there are high hopes for using these scores in clinical practice to improve disease risk estimates and predictive accuracy. The heritability, i.e. the proportion of phenotypic variance that is attributable to genetics, determines an upper limit on the predictive performance of PGS and thus their value as a predictive tool. Nevertheless, a number of studies have shown the potential benefits of using PGS in clinical settings (Abraham et al., 2019; Pashayan et al., 2015; Willoughby et al., 2019). PGS are also extensively used in epidemiology and economics as predictive variables of interest (Barth et al., 2020; Harden and Koellinger, 2020; Horsdal et al., 2019; Musliner et al., 2015). For example, a recently derived PGS for education attainment has been one of the most predictive variables in behavioral sciences so far (Allegrini et al., 2019). LDpred is a popular method for deriving polygenic scores based on summary statistics and a Linkage Disequilibrium (LD) matrix only (Vilhjálmsson et al., 2015). However, LDpred has several limitations that may reduce its predictive performance. The non-infinitesimal version of LDpred, which assumes there is a proportion p of variants that are causal, is a Gibbs sampler and is particularly sensitive to model misspecification when applied to summary statistics with large sample sizes. It is also unstable in long-range LD regions such as the human leukocyte antigen (HLA) region of chromosome 6. This issue has led to the removal of such regions from analyses (Lloyd-Jones et al., 2019; Marquez-Luna et al., 2020), which is unfortunate since this region of the genome contains many known disease-associated variants, particularly with autoimmune diseases and psychiatric disorders (Matzaraki et al., 2017; Mokhtari and Lachman, 2016). 2 APPROACH Here, we present LDpred2, a new version of LDpred that addresses these issues while markedly improving its computational efficiency, allowing exploring a larger grid of parameters in the same computational time as LDpred1. We provide this faster and more robust implementation of LDpred in R package bigsnpr (Privé et al., 2018). We also provide two new options in LDpred2. First, we provide a ‘sparse’ option, where LDpred2 truly fits some effects to zero, therefore providing a sparse vector of effects. Second, we also provide an ‘auto’ option, where LDpred2 automatically estimates the sparsity p and the SNP heritability h2, and therefore does not require validation data to tune hyper-parameters. We show that LDpred2 provides higher predictive performance than LDpred1 (LDpred v1.0.0), especially when there are causal variants in long-range LD regions, when the proportion of causal variants is small, and when GWAS sample size is large. We also show that the new sparse option performs equally well as the non-sparse version, enabling LDpred2 to provide sparse effects without losing any predictive accuracy. Moreover, LDpred2-auto, which does not require any validation set, performs almost as well as the main LDpred2 model that tunes hyper-parameters from a grid in a validation set, provided some quality control is performed on the summary statistics. 3 MATERIALS AND METHODS 3.1 Simulation analyses We use the UK Biobank imputed data for both real data analyses and simulations (Bycroft et al., 2018). We use dosage data for LDpred2, which we read from BGEN files using function snp_readBGEN from R package bigsnpr (Privé et al., 2018). For the other software that require a PLINK bed file as input, we use function snp_writeBed that round dosages to write genotype data in bed format. We restrict individuals to the ones used for computing the principal components (PCs) in the UK Biobank (Field 22020). These individuals are unrelated and have passed some quality control including removing samples with a missing rate on autosomes larger than 0.02, having a mismatch between inferred sex and self-reported sex, and outliers based on heterozygosity (more details can be found in section S3 of Bycroft et al. (2018)). To get a set of genetically homogeneous individuals, we compute a robust Mahalanobis distance based on the first 16 PCs and further restrict individuals to those within a log-distance of 5 (Privé et al., 2020). We restrict variants to the HapMap3 variants used in PRS-CS (Ge et al., 2019). This results in 362 320 individuals and 1 117 493 variants. We use 10 000 individuals as validation set for choosing optimal hyper-parameters and for computing correlations between variants (LD matrix R). We use 300 000 other individuals for running logistic GWAS to create summary statistics. We use the remaining 52 320 individuals as test set for evaluating models. We simulate binary phenotypes with a heritability of h2=0.4 using a Liability Threshold Model (LTM) with a prevalence of 15% (Falconer, 1965). We vary the number of causal variants (300, 3000, 30 000 or 300 000) to match a range of genetic architectures from low to high polygenicity. Causal variants are chosen randomly anywhere on the genome. Liability scores are computed from a model with additive effects only: we compute the liability score of the i-th individual as yi=∑j∈ScausalwjG˜i,j+ϵi, where Scausal is the set of causal variants, wj are weights generated from a Gaussian distribution N(0,h2/|Scausal|), Gi,j is the allele dosage of individual i for variant j, G˜i,j corresponds to its standardized version (zero mean and unit variance), and ϵi follows a Gaussian distribution N(0,1−h2). Both parts of the yi’s are scaled such that the variance of the genetic liability is exactly h2 and the variance of the total liability is exactly 1. Such simulation of phenotypes based on real genotypes is implemented in function snp_simuPheno of R package bigsnpr. We also vary the sample size to compute GWAS summary statistics in the scenario with 3000 causal variants; in addition to a GWAS sample size of 300 000, we also use 10 000, 20 000, 50 000 and 120 000. We design two other simulation scenarios with 300 or 3000 causal variants randomly chosen in the HLA region (chromosome 6, 25.5-33.5 Mb). In these two scenarios, we use h2=0.3 instead of h2=0.4 because the total heritability is gathered in one chromosome only. Finally, we design a seventh simulation scenario as a mixture of previous scenarios; we simulate 300 causal variants in the HLA region explaining 20% of the variance in liability, and 10 000 causal variants anywhere on the genome explaining another 20% (h2=0.4 in total). All simulation scenarios are summarized in Table 1. Each simulation scenario is repeated 10 times and averages of the Area Under the ROC Curve (AUC) are reported. The 95% confidence interval (CI) from 10 000 non-parametric bootstrap replicates of the mean AUC of the 10 simulations for each scenario is also reported. In other words, we sample 10 000 bootstrap replicates of these 10 AUC values and compute their respective mean. We then report the mean of these 10 000 values, along with their quantile at 2.5% and at 97.5% to act as the 95% confidence interval (CI) for the mean AUC. [Table: The seven simulations scenarios] 3.2 Real data analyses We use the same data as in the simulation analyses. We use the same 10 000 individuals as validation set, and use the remaining 352 320 individuals as test set. We use external published GWAS summary statistics listed in Table 2. We defined phenotypes as in Privé et al. (2019). Briefly, we use self-reported illness codes (field 20001 for cancers and 20002 otherwise) and ICD10 codes (fields 40001, 40002, 41202 and 41204 for all diseases and field 40006 specifically for cancers). Some quality control is applied to summary statistics (see Method section ‘Quality control of summary statistics’ below). For more details, please refer to our R code (Software and code availability section). [Table: Summary of external GWAS summary statistics used] In real data applications, we first compare all four LDpred2 models to the two LDpred1 models. Then, we compare LDpred2-inf, LDpred2-grid and LDpred2-auto to several other methods: Clumping and Thresholding (C+T), Stacked C+T (SCT), lassosum(-auto), PRS-CS(-auto) and SBayesR (Ge et al., 2019; Lloyd-Jones et al., 2019; Mak et al., 2017; Privé et al., 2019). For C+T and SCT (Privé et al., 2019), we use the default large grid of hyper-parameters testing a threshold of clumping rc2 within {0.01, 0.05, 0.1, 0.2, 0.5, 0.8, 0.95}, a base size of clumping window within {50, 100, 200, 500} in Kb where the actual window size is then computed as the base size divided by rc2, and a sequence of 50 thresholds on -log10(P-values) between 0.1 and the most significant P-value, equally spaced on a log scale. For lassosum (Mak et al., 2017), we use the default grid of hyper-parameters s and λ. We also alternatively choose the optimal hyper-parameters based on pseudo-validation (instead of choosing them based on performance in the validation set) and refer to this method as lassosum-auto. For PRS-CS (Ge et al., 2019), we use the grid {10−6,10−5,10−4,10−3,0.01,0.1,1} for the global scaling hyper-parameter Φ, and the default values for hyper-parameters a (1) and b (0.5). PRS-CS-auto automatically estimates Φ. Finally, for SBayesR (Lloyd-Jones et al., 2019), shrunk LD matrices are built using option ‘–make-shrunk-ldm’ and SBayesR is run with parameters ‘–pi 0.95,0.02,0.02,0.01’ and ‘–gamma 0.0,0.01,0.1,1’, and a chain of length 10 000 with 2000 burn-in iterations. Note that we use the 10 000 individuals of the validation set as LD reference for all methods, except for PRS-CS which provides its own LD reference based on 503 individuals from the 1000 Genomes data; Ge et al. (2019) argued that the sample size of the LD reference has little impact on the performance of PRS-CS. We use the Area Under the ROC Curve (AUC) to compare methods. We sample 10 000 bootstrap replicates of the individuals in the test set and compute the AUC for each of these. We then report the mean of these 10 000 values, along with their quantile at 2.5% and at 97.5% to act as the 95% confidence interval (CI) for the AUC. This is implemented in function AUCBoot of R package bigstatsr. 3.3 From marginal effects to joint effects In this section, we explain how we can obtain joint effects from summary statistics (marginal effects) and a correlation matrix R. Let us denote by S the diagonal matrix with standard deviations of the m variants, Cn=In−11T/n the centering matrix, G the genotype matrix of n individuals and m variants and y the phenotype vector for n individuals. When solving a joint model with all variants and an intercept α, the joint effects γjoint are obtained by solving [formula: [α^γ^joint]=([1G]T[1G])−1[1G]Ty .] Using the Woodburry formula, we get [formula: γ^joint=(GTCnG)−1GTCny .] When fitting each variant separately in GWAS, the marginal effects (assuming no covariate) simplify to [formula: γ^marg=1n−1S−2GTCny .] We further note that the correlation matrix of G is [formula: R=1n−1S−1GTCnGS−1 .] Then we get [formula: (1)γ^joint=S−1R−1Sγ^marg .] In practice, the correlation matrix R is usually not available but is computed from another dataset. Also note that γ are the effects on the allele scale while we denote by β=Sγ the effects of the scaled genotypes. For the marginal effect γ^j of variant j, let us denote by y⌣ and G⌣j the vectors of phenotypes and genotypes for variant j residualized from K covariates, e.g. centering them. Then, [formula: (se(γ^j))2=(y⌣−γ^jG⌣j)T(y⌣−γ^jG⌣j)(n−K−1) G⌣jTG⌣j≈y⌣Ty⌣n G⌣jTG⌣j≈var(y)n var(Gj) .] The first approximation is possible because γ^j is expected to be small, while the second approximation assumes that the effects from covariates are small. Thus we can derive [formula: (2)sd(Gj)≈sd(y)se(γ^j) n] and then (sd(Gj) γ^j)≈γ^jse(γ^j)sd(y)n. Let us go back to equation 1. As sd(y) is the same for all variants, it is canceled out by S−1 and S, therefore we can assume that var(y)=1. It justifies the use of the Z-scores (γ^j / se(γ^j)) divided by n as input for LDpred (first line of algorithm 1). Then, the effect sizes that LDpred outputs need to be scaled back by multiplying by (se(γ^j) n) (last line of algorithm 1). In LDpred2, we allow for having different nj for different variants. Note that LDpred1 and other similar methods scale the output dividing by the standard deviation of genotypes. This is correct when var(y)=1 only. 3.4 Quality control of summary statistics For summary statistics of binary traits derived from a logistic regression, instead of equation (2), we have [formula: (3)sd(Gj)≈2se(γ^j) neff ,] where neff=41/ncase+1/ncontrol. We strongly recommend to verify this assumption and to perform some quality control. Indeed, in simulations, the approximation of equation (3) seems valid (Supplementary Fig. S6). However, in real data applications, where summary statistics come from a meta-analysis of many external datasets, this approximation can be invalidated (Supplementary Fig. S7). Let us denote by SDss the standard deviations derived from the summary statistics (right-hand side of equation (2) or (3)) and by SDval the standard deviations of genotypes of individuals in the validation set (left-hand side). Note that, in order to compute SDss in the case of summary statistics from a linear regression, sd(y) from equation (2) can be estimated e.g. by the median value of (sd(Gj)·se(γ^j)·n) or by using the fact that the maximum value of SDss should be 0.5, i.e. estimating sd(y) by min(0.5·se(γ^j)·n). We recommend removing variants with SDss<0.5·SDval or SDss>0.1+SDval or SDss<0.1 or SDval<0.05 (Supplementary Fig. S7). 3.5 Overview of LDpred model LDpred assumes the following model for effect sizes, [formula: (4)βj=Sj,jγj∼ {N(0,h2Mp)with probability p,0otherwise,] where p is the proportion of causal variants, M the number of variants and h2 the (SNP) heritability. Vilhjálmsson et al. (2015) estimate h2 using constrained LD score regression (intercept fixed to 1) and recommend testing a grid of hyper-parameter values for p (1, 0.3, 0.1, 0.03, 0.01, 0.003 and 0.001). To estimate effect sizes βj, we use a Gibbs sampler as in Vilhjálmsson et al. (2015), which is described in algorithm 1. First, the residualized marginal effect for variant j is computed as [formula: (5)β˜j=β^j−β-jTR-j,j] where R-j,j is the j-th column without the j-th row of the correlation matrix, β^ is the vector of marginal effect sizes, β is the vector of current effect sizes in the Gibbs sampler, and β-j is β without the j-th element. Then, the probability that variant j is causal is computed as [formula: p¯j=P(βj∼N(·,·) | β˜j)=ph2Mp+1nexp {−12β˜j2h2Mp+1n}ph2Mp+1nexp {−12β˜j2h2Mp+1n}+1−p1nexp {−12β˜j21n} ,] which we rewrite as [formula: (6)p¯j=11+1−pp1+nh2Mp exp {−12nβ˜j21+Mpnh2} .] Computing p¯j using the second expression is important to avoid numerical issues when (nβ˜j2) is large. Then, βj is sampled according to [formula: (7)βj | β˜j∼ {N(11+Mpnh2β˜j,11+Mpnh21n)with probability p¯j,0otherwise.] Therefore, the posterior mean of βj | β˜j is given by [formula: (8)ωj=p¯jβ˜j1+Mpnh2 .] Algorithm 1 LDpred, with hyper-parameters p and h2, LD matrix R and summary statistics γ^, se(γ^) and n1: β^←γ^se(γ^)·n ▹ Initialization of scaled marginal effects (see previous section)2: Ω←0 ▹ Initialization of posterior means3: for  k=1,…,Nburn-in+Niter  do ▹ Gibbs iterations4: for each variant j do ▹ All variants5: Compute β˜j according to (5)6: Compute p¯j according to (6)7: Sample βj according to (7)8: Compute ωj according to (8)9: end for10: if  k>Nburn-in  then11: Ω←Ω+ω12: end if13: end for14: Ω←Ω/Niter ▹ Average of all ω after burn-in15: Return Ω·se(γ^)·n ▹ Return posterior means, scaled back (see previous section) 3.6 New LDpred2 models LDpred2 comes with two extensions of the LDpred model. The first extension consists in estimating p and h2 within the model, as opposed to testing several values of p and estimating h2 using constrained LD score regression (Bulik-Sullivan et al., 2015). This makes LDpred2-auto a method free of hyper-parameters which can therefore be applied directly to data without the need of a validation dataset to choose best-performing hyper-parameters. To estimate p in the Gibbs sampler, we count the number of non-zero variants (i.e. Mc=∑j(βj≠0) in equation 7). We can assume that Mc∼Binom(M,p), so if we place a prior p∼Beta(1,1)≡U(0,1), we can sample p from the posterior p∼Beta(1+Mc,1+M−Mc). Due to complexity reasons, we could not derive a Bayesian estimator of h2. Instead, we estimate h2=βTRβ, where R is the correlation matrix. These parameters p and h2 are updated after the inner loop in Algorithm 1, then these new values are used in the next iteration of the outer loop. The second extension, which can be enabled using a third hyper-parameter in LDpred2-grid, aims at providing sparse effect size estimates, i.e. some resulting effects are exactly 0. When the sparse solution is sought and when p¯j