Why Expression-Prediction Weights Matter
A TWAS expression predictor is a model that uses nearby genetic variants to estimate an individual's genetically predicted expression for a gene in a particular tissue. The model is trained using people for whom both genotype and expression measurements are available. Its fitted SNP coefficients, or prediction weights, are then applied to genotype data in a separate association analysis.
These weights are not interchangeable labels for a gene. They depend on the training sample, tissue, expression processing, variant set, genotype coding, and prediction method. A gene can be tested with a particular model only when the required genotype information is available and the model predicts expression adequately under the chosen validation criteria. These conditions concern whether a usable predictor exists; they do not by themselves establish that the gene is associated with a trait.
How a Predictor Is Trained
The training data contain expression measurements and genotypes for a set of individuals. For a gene in a specified tissue, let \(Y_i\) denote the processed expression measurement for individual \(i\), and let \(G_{ij}\) denote the genotype dosage for variant \(j\). A dosage commonly counts copies of a designated allele and takes values 0, 1, or 2. A cis set is a defined collection of variants in or near the gene; its genomic boundaries and quality-control rules should be specified rather than assumed to be universal.
Expression is usually processed before fitting. This may include normalization and adjustment for technical or biological covariates, such as batch or measured cell composition, when appropriate to the training design. Genotypes also require quality control and a fixed allele coding. The fitted model therefore predicts the processed expression phenotype used in training, not an abstract, universally scaled quantity. If expression is standardized in the training data, predicted values are on that standardized scale; if it is not, predictions retain the model's expression units.
A simple model estimates the weights by minimizing squared prediction errors. With many correlated cis variants and a modest expression sample, an unpenalized regression can be unstable. Common approaches therefore use regularization, such as ridge regression, the lasso, elastic net, or Bayesian shrinkage methods. These approaches differ in how they shrink or select weights, but all produce a predictor tied to the chosen variants and training data. The tuning choices, including any penalty strength, should be made using training data alone, typically with cross-validation.
A fitted weight is a predictive coefficient, not automatically a causal effect of the variant on expression. Correlated variants can share or exchange predictive signal, particularly when the model uses shrinkage or selection. A nonzero weight does not, by itself, prove that its variant directly regulates the gene.
Worked Example: Applying Two Standardized Genotype Weights
Suppose a hypothetical model was trained for one gene in one tissue. Both the expression outcome and the two genotype predictors were standardized in the training data. The fitted prediction weights are \(w_1=0.30\) and \(w_2=-0.10\), with an intercept of zero on the standardized expression scale. For one hypothetical individual, the standardized genotype values are \(G_1=1.0\) and \(G_2=2.0\).
The model's predicted expression is \(\widehat{Y}=0+(0.30)(1.0)+(-0.10)(2.0)=0.30-0.20=0.10\).
Because the outcome was standardized during training, this score is \(0.10\) standard deviations on that training expression scale. The positive first contribution and negative second contribution partially offset. If the outcome had not been standardized, the same arithmetic would instead be expressed in the model's original expression-outcome units; standardized genotype inputs alone do not make the prediction an expression standard deviation.
What the Weights Mean—and Do Not Mean
For an ordinary linear regression with a single centered genotype predictor \(G\), a centered outcome \(Y\), and no other predictors, the least-squares coefficient has a direct algebraic interpretation. It is the coefficient that minimizes the sum of squared residuals. Differentiating that sum gives
The denominator is positive when the genotype varies in the training sample. Thus the coefficient is determined by the joint pattern of genotype and expression in that sample. With multiple variants, the corresponding regression accounts for their joint relationships; with regularization, the fitted coefficients also reflect the penalty. In either case, the coefficient's units depend on the genotype and expression scales. If \(G_j\) is an unstandardized allele dosage and \(Y\) is expression in a specified unit, \(w_j\) describes the fitted change in predicted \(Y\) per one-dosage increase, conditional on the model's other inputs. If either variable is standardized, the interpretation changes accordingly.
For a particular individual, the predictor adds the contributions from all included variants. This gives a model-based expression score, not a direct measurement of that individual's expression. In applications, allele orientation and genotype coding must match the specification used to create the weights. A weight for the count of one allele cannot be applied as though it were a weight for the alternate allele without an appropriate recoding.
Worked Example: Computing a Score With Allele Alignment
Consider a hypothetical predictor for which the expression outcome was standardized in training. The model uses three allele dosages, centered by their training means, and has an intercept of \(0.05\). Its weights are \(0.20\) for copies of allele C at rsA, \(-0.15\) for copies of allele T at rsB, and \(0.10\) for copies of allele G at rsC. The training mean dosages for these alleles were \(0.8\), \(0.6\), and \(1.1\), respectively. In a hypothetical target genotype file, rsA dosage counts allele A rather than C and equals 1; the dosages for T at rsB and G at rsC are 2 and 1.
At rsA, the dosage of C is \(2-1=1\), because each diploid genotype has two allele copies. The centered inputs are therefore \(1-0.8=0.2\) for rsA, \(2-0.6=1.4\) for rsB, and \(1-1.1=-0.1\) for rsC.
The prediction is \(\widehat{Y}=0.05+(0.20)(0.2)+(-0.15)(1.4)+(0.10)(-0.1)\) \(=0.05+0.04-0.21-0.01=-0.13\).
The score is \(-0.13\) on the standardized expression scale used in training. If rsC were absent from the genotype data, this full three-variant predictor could not be calculated as specified. Treating the missing genotype as zero would generally be wrong: zero dosage is not the same as a centered dosage of zero, and it does not supply the missing individual's genotype. A documented imputation or model-specific missing-variant procedure would be needed.
Validation: Measuring Prediction Beyond the Training Sample
A model's fit in its training data is not sufficient evidence that it predicts expression well in new individuals. Flexible models can fit training-specific noise, and tuning a model on the same observations used to report its performance can make that performance optimistic. Prediction should therefore be evaluated using observations not used to fit or tune the model, for example a held-out validation sample or an appropriately designed cross-validation procedure.
One common summary is the coefficient of determination in the validation sample, calculated against a specified baseline. A simple version uses the validation-sample mean as the baseline and is \(R^2_{\mathrm{val}}=1-\sum_i(Y_i-\widehat{Y}_i)^2/\sum_i(Y_i-\bar{Y}_{\mathrm{val}})^2\). Here \(\bar{Y}_{\mathrm{val}}\) is the validation mean. This value can be negative when predictions perform worse than the baseline. Correlation between observed and predicted expression is also reported in some settings, but correlation alone does not assess calibration: predictions can track variation while being systematically too large or too small.
Validation performance is specific to the gene, tissue, sample, and processing choices. It is also affected by the similarity between training and target populations, including allele frequencies and linkage disequilibrium patterns. A threshold for accepting a predictor is a study or analysis choice, not a universal law. The rule should be set and reported clearly; different thresholds can produce different sets of testable gene–tissue pairs.
Worked Example: Comparing Two Models in Held-Out Data
In a hypothetical validation sample, the standardized observed expression values for one gene are \(-1, 0, 1, 0\). Model A predicts \(-0.8, 0.2, 0.7, -0.1\); Model B predicts \(-0.5, 0.1, 0.5, -0.1\). The validation mean is zero, so the baseline sum of squares is \((-1)^2+0^2+1^2+0^2=2\).
For Model A, the residuals (observed minus predicted) are \(-0.2,-0.2,0.3,0.1\). Its residual sum of squares is \(0.04+0.04+0.09+0.01=0.18\), giving \(R^2_{\mathrm{val}}=1-0.18/2=0.91\).
For Model B, the residuals are \(-0.5,-0.1,0.5,0.1\). Its residual sum of squares is \(0.25+0.01+0.25+0.01=0.52\), giving \(R^2_{\mathrm{val}}=1-0.52/2=0.74\). On this validation sample and by this metric, Model A predicts better. These values are illustrative, not evidence about any real gene. They do not establish that either model will perform equally well in a different population or tissue.
Which Gene–Tissue Pairs Can Be Tested?
A gene–tissue pair is eligible for a TWAS analysis using a particular prediction resource only if the corresponding expression model is available and can be applied to the analysis genotypes under the model's variant and allele conventions. In practice, eligibility depends on several linked checks:
- Model availability: weights exist for the specified gene and tissue, and the training and processing details are sufficiently documented.
- Prediction evidence: the model meets the prespecified validation criterion, if the analysis requires one.
- Variant correspondence: required SNPs can be matched to the analysis data, with compatible identifiers, genome build, and alleles.
- Usable genotype information: allele coding is aligned, and missing variants are handled only by a documented, appropriate procedure.
The exact variant set matters. A predictor trained on one cis window is not automatically the same predictor as a model for the same gene trained on a wider window or a different set of quality-controlled variants. Nor is it generally valid to discard unavailable variants and retain the remaining weights unchanged: the model's prediction rule has then changed, and its validation performance no longer necessarily applies. If an analysis uses a reduced SNP set, that choice needs a defensible model-specific procedure and appropriate performance assessment.
Training sample size alone does not determine whether a model is useful. The number of cis variants, their correlation structure, expression variability, tissue relevance, and validation design also matter. Conversely, a high in-sample fit is not a substitute for out-of-sample validation. The goal is not simply to produce a list of nonzero weights, but to establish a defined, transferable prediction rule that can be applied consistently.
Worked Example: Deciding Whether a Model Is Usable
Suppose a hypothetical analysis prespecifies that a gene–tissue predictor is retained only if its held-out validation \(R^2\) is at least \(0.10\) and all model variants can be matched in the association genotype data. A model for Gene A in Tissue 1 has validation \(R^2=0.14\), and every required variant is present with aligned alleles. It meets both stated criteria and is eligible under this rule.
A model for Gene B in Tissue 1 has validation \(R^2=0.08\), although its variants are all present. It does not meet the performance criterion. A model for Gene C in Tissue 2 has validation \(R^2=0.22\), but one required variant cannot be matched and no missing-variant procedure is specified. It does not meet the variant-availability criterion. Thus, only Gene A in Tissue 1 is eligible under the hypothetical rule. This conclusion concerns predictor eligibility, not the presence or absence of a trait association.
Common Mistakes and a Practical Workflow
Several errors can make a correctly calculated score scientifically misleading. The most important are treating a weight as a causal effect, assuming all prediction scores are in standard-deviation units, and applying weights to allele dosages coded in the opposite direction. A fourth error is reporting training fit as though it were validation performance. These problems can be prevented by preserving the full model specification: outcome processing and scale, SNP list, allele coding, centering or scaling, fitted weights, intercept, and validation procedure.
Name the gene and tissue, define the expression phenotype and its processing, and state the cis-variant set.
Choose a prediction method and tune it without using the held-out validation observations.
Report the validation design and metric, and apply the prespecified model-retention rule.
Match variants and alleles, apply the specified coding and scaling, and identify models that cannot be used as defined.
The central distinction is between training a prediction rule and testing an association using that rule. Training produces weights and a defined expression scale; validation assesses prediction in held-out data; variant matching determines whether the rule can be applied. A usable predictor is a necessary input for a TWAS gene test, but it is not itself evidence that the predicted expression is associated with a trait.
Check Your Understanding
Use the model specification and validation information in each question; distinguish prediction from association.
- If genotypes are standardized but expression is not, what units does a predicted expression score use?
- Why should a model's prediction performance be assessed on observations not used to fit or tune it?
- A weight counts copies of allele A, but the available genotype file counts copies of the other allele. What must be checked before applying the weight?
- Why is it generally invalid to omit a missing SNP and use the remaining weights unchanged?
- Can a high validation \(R^2\) by itself establish that a gene causes a trait? Explain briefly.