Quantitative Structure–Activity Relationship · Introduction

QSAR Teaching Manual: What Makes Someone Good at Basketball?

Forty students in a class, each measured on twenty things. Regress all twenty against basketball ability one at a time, rank them by correlation, and pick out the few that really matter. That is exactly what QSAR does — chemists just swap "students" for "molecules".

What QSAR asksWhich features of a molecule's structure decide its potency or its toxicity?
How it is computedTurn each molecule into a row of numbers (descriptors), regress each one against activity, and rank them by r².
How to read itThe ranking is only statistics. What stays and what gets struck out depends on your understanding of the subject.
students40
features20
regression1
random decoys100
01 · Data

Turning people into a row of numbers

Regression cannot work on "this person", only on numbers. So the first step is to turn every student into a row of measurable values. In QSAR these values are called descriptors.

The last column, the basketball ability rating, is what we are trying to explain — an overall score the PE teacher gave after watching a semester of games, and a continuous value. In QSAR it corresponds to potency or toxicity: pIC₅₀, pKi, pLC₅₀.

The table scrolls sideways.

Notice that a few obviously irrelevant columns are mixed in — the IQ test, the math score, hours of sleep, the seat number. They are controls, and they will earn their keep shortly.
02 · Measurement

How the rating was measured

Before choosing features, there is a question that often gets skipped: is the column we are trying to explain measured well? "Basketball ability" cannot be seen directly; you have to pick a way of measuring it. This page uses the PE teacher's rating after a semester of games, but that is not the only option:

MethodStrengthProblem
Teacher's rating (this page)A holistic judgement that sees defence, passing and court senseSubjective; a different teacher gives different scores
Skills test (spot shooting, timed dribbling)Objective and repeatableMeasures skill only — and is the same thing as the shooting and dribbling columns
Game results (points or win rate with random teams)Closest to real abilityDepends on teammates and opponents; needs many games to settle
The trap in a teacher's rating: the halo effect. A tall student looks like a basketball player just by standing on the court, and the teacher's scores may lean their way without anyone noticing. Part of height's r² then comes not from play but from the teacher's eye — the leaderboard is measuring "who the teacher thinks can play". The remedies: two teachers rating independently, a rubric agreed in advance, and averaging.

Then there is noise. Take shooting: someone whose true hit rate is 50% will often score anywhere from 34% to 66% over 10 shots (one SD either way), and only settles to within ±5% after 100:

Shots takenSD of the hit rate
10±16%
50±7%
100±5%
SD = √[ p(1 − p) / n ]  p = 0.5

A noisy y costs every feature. How well two measurements of the same person agree is called reliability (0 to 1), and it caps the correlation you can observe:

robserved ≤ √( reliability of x × reliability of y )

If the teacher's rating has a reliability of only 0.6, then even a feature perfectly related to true ability cannot reach an r² above 0.6 on the leaderboard. A low r² does not always mean a useless feature; it can mean a poorly measured y.

In QSAR, y is the measured activity. The IC₅₀ of the same compound can differ between laboratories and between assays (enzyme, cell) — just like switching teachers. Putting activities from different sources into one column is like ranking the scores of three teachers together. So before modelling, ask: how was the activity measured, was it replicated, and do the values come from one source?
03 · Method

One feature at a time

The simplest approach: take one feature, plot it against the ability rating, draw the line that fits best, and see how close the points sit to that line. The line is the regression; how close is measured by r² — 0 means no relationship at all, 1 means every point lies exactly on the line.

  1. Pick one featureHeight, for example.
  2. Plot the scatterHeight on the x axis, ability rating on the y axis: 40 students, 40 points.
  3. Fit the lineLeast squares finds the straight line closest to those points.
  4. Compute r²How close the points sit to the line.
  5. Repeat for the other 19Steps 1–4 again for every remaining feature.
  6. Rank by r²That gives you the leaderboard.

The correlation coefficient r is the covariance of the two variables divided by each one's spread:

r = Σ(xᵢ − x̄)(yᵢ − ȳ) / √[ Σ(xᵢ − x̄)² · Σ(yᵢ − ȳ)² ]  r² = r × r

This "try them one at a time and rank by r²" procedure has a name: univariate screening. The only difference is that a chemist is not working through 20 features but through more than 500.

40
Leaderboard

r
r²
n

The plot scrolls sideways.

The colours on the leaderboard are the answer key: really related has a catch peeks at the answer unrelated  Real research comes with no colours — which is the whole point of section 5.

04 · Reading it

What the leaderboard says

Three things in the full 40-student result are worth stopping on.

Your intuition was right

Height does sit near the top. You could have guessed that — but now you have a number, and you know what fraction of the variation in the rating it accounts for.

Some correlations are negative

For the 50 m sprint, fewer seconds means better, so r is negative. Strength is |r|; the sign only tells you the direction.

Unrelated means unrelated

The seat number has an r² of essentially zero and the scatter is a shapeless cloud. So do the IQ test, the math score and hours of sleep. That is what a control should look like.

05 · Traps

Four things the leaderboard will not tell you

This section is the heart of the manual. Ranking high is not the same as meaning something. Statistics only does the arithmetic; the interpretation rests on your understanding of the subject.

Shoe size made the board

Shoe size really does correlate with the rating, and not far down the list. But big feet do not make anyone good at basketball — people with big feet are simply taller. Shoe size is measuring height.

The top of the board says one thing

Height, arm span, hand length and shoe size all cluster together. They look like four features; they are really one: this person is big. That is collinearity.

Which is cause, which is effect

Practice hours correlates reasonably well. But do they practise more and get better, or get better and enjoy practising? Statistics cannot separate the two; both look identical on a scatter plot.

It peeked at the answer

Baskets per minute tops the board. But it is part of basketball ability itself — predicting the answer from a piece of the answer is bound to work. This is data leakage.

The evidence on shoe size: plot shoe size against height and the points fall almost on a line — they measure the same thing. On the right is the control: between shoe size and the IQ test there is nothing at all.

Shoe size vs height

r²

Shoe size vs IQ test

r²

The plots scroll sideways.

This happens in QSAR every day. Molecular weight, surface area, volume and atom count all crowd into the top of the leaderboard, and every one of them is saying the same thing: this molecule is large. The chemist has to recognise it — the statistics will not point it out.
06 · Significance

How much counts as related

The dashed line on the leaderboard is the significance level (α = 0.05). Any r² below it is reachable by luck alone with this many students. Where the line sits depends on the sample size:

r²crit = t² / (df + t²)  df = n − 2, with t the two-tailed α = 0.05 critical value

With 40 students the line sits at r² = 0.097. With only 8, it jumps to 0.499.

Try it: drag the sample size from 40 down to 10. The dashed line climbs, and features that were "significant" drop below it one by one — the data has not changed and the molecules have not changed; you simply measured fewer of them. This is how small-sample studies most often fail.
Then try this: tick "Add 100 unrelated features". D001–D100 are pure random numbers with no connection to basketball whatsoever. With 40 students, exactly 5 of them cross the significance line — which is the literal meaning of α = 0.05: out of every 100 unrelated features, about 5 will reach "significance" by luck. Significance has never meant "guaranteed to be related".
Now drag the sample size to 8: first place on the leaderboard goes to a pure random-number feature with an r² of 0.80 — beating height, beating vertical jump, beating everything real. It represents nothing.
This is the situation real QSAR is in. A typical study may have more than 500 descriptors and only about 40 compounds. With ten times more descriptors than samples, chance alone produces a pile of spurious high correlations. This is p ≫ n, the hardest problem in QSAR.
07 · Answer

So what is the answer

With the traps struck out, these are the features that actually hold up:

Feature keptWhy
HeightStands for the body-size cluster. Arm span, hand length and shoe size all say the same thing, so there is no need to keep them too.
Vertical jumpStands for the athleticism cluster.
Sprint and shuttle-run timesThe other face of the same cluster, negatively correlated.

The skill measures — baskets, free throws, dribbling — rank highest, but they are ability itself, not its source. For someone who has never played, those numbers simply do not exist yet. Practice hours matter, but the causal direction is unclear.

Note that this last step used no statistics at all. It was your understanding of basketball that decided what stayed and what was struck out. The statistics only handed you a ranking.
08 · Back to molecules

Swap in molecules and it is QSAR

Replace every term in this manual and you have a real QSAR study. The method is identical.

One student→One compound
Height, shoe size, vertical jump→Molecular weight, logP, polar surface area
Basketball ability rating→Potency or toxicity (pIC₅₀, pKi, pLC₅₀)
40 students in a class→40 compounds
Try one at a time, rank by r²→Univariate screening, the first step of model building
Shoe size and height are one thing→Molecular weight and surface area are collinear
The D001–D100 random features→Spurious hits among 500+ descriptors
Find what makes someone good at basketball→QSAR

With basketball you have intuition: you can see at a glance that "seat number" is nonsense.
With molecules you do not — nobody can tell by looking whether a given descriptor ought to matter.

That is what makes QSAR genuinely hard. It is also why a QSAR model cannot rest on a pretty r² alone: it has to make physical sense, and the top-ranked descriptor has to correspond to a real interaction. Validation comes not only from the statistics but from the correspondence with the real world.