14.3 Correlation, Linear Regression, Beta, and Hypothesis Testing Basics

Key Takeaways

  • Pearson correlation (r) standardizes covariance onto a bounded scale from -1 to +1 and for return co-movement, use aligned returns rather than trending price levels and check stability

  • Diversification benefits can erode if correlations across risky assets rise during market stress in a phenomenon known as regime breakdown

  • In simple linear regression, beta equals Cov(X,Y)/Var(X) and measures systematic sensitivity, while with an intercept, R-squared equals r-squared and represents the fraction of variance explained

  • Technical analysts construct linear regression trend channels by plotting an ordinary least squares centerline flanked by +/-1 or +/-2 standard error bands

  • Running hundreds of unadjusted backtests inflates Type I error (false positives) through data snooping, making out-of-sample and walk-forward testing mandatory

Last updated: December 2026

Quantifying Relationships and Testing Trading Rules

Technical analysis rarely evaluates a single chart in isolation. Intermarket analysts compare equities against bonds and commodities, portfolio managers measure how tightly an equity tracks its benchmark, and system developers test whether an indicator's historical edge reflects genuine market structure or random noise. Correlation, linear regression, and hypothesis testing provide the statistical framework for all three tasks.


Visualizing Data and Screening Outliers

Numerical summaries can hide structure. A histogram shows the frequency distribution (center, dispersion, skew and extreme observations); a box plot summarizes quartiles and extremes. Define the interquartile range (IQR) as Q3 − Q1. The conventional inner fences for potential outliers are Q1 − 1.5 × IQR and Q3 + 1.5 × IQR. For example, Q1 = 2 and Q3 = 6 give IQR = 4, fences −4 and 12, and an observation of 15 is flagged. Investigate whether it is a data error or genuine market event; do not automatically delete real crashes. A scatterplot of paired observations describes direction (positive/negative), form (linear/nonlinear) and strength (concentration around the form); it also exposes clusters and outliers. None of these establishes causation.

Covariance and Pearson Correlation

Covariance

Sample covariance measures how two variables XX and YY move together around their respective means:

Cov(X,Y)=1n−1∑i=1n(Xi−Xˉ)(Yi−Yˉ)\text{Cov}(X, Y) = \frac{1}{n - 1} \sum_{i=1}^{n} (X_i - \bar{X})(Y_i - \bar{Y})

Positive covariance indicates that XX and YY tend to rise and fall together; negative covariance indicates they move inversely. However, covariance is unbounded and expressed in the product of the variables’ units, making it impossible to judge relationship strength from covariance alone.

Pearson Correlation Coefficient (rr)

Dividing covariance by the product of the two sample standard deviations creates the Pearson correlation coefficient (rr), a unitless measure bounded between −1-1 and +1+1:

r=Cov(X,Y)sX sY,−1≤r≤+1r = \frac{\text{Cov}(X, Y)}{s_X \, s_Y}, \qquad -1 \le r \le +1
  • r=+1.0r = +1.0: Perfect positive linear relationship (assets move proportionally in the same direction).
  • r=0.0r = 0.0: No linear relationship (note that two variables can still share a strong non-linear pattern while registering r≈0r \approx 0).
  • r=−1.0r = -1.0: Perfect negative linear relationship in the sample; hedge size and future stability still matter.

Two Critical Traps: Spurious Correlation and Regime Breakdown

  1. Spurious Correlation: Correlation never proves causation, and in finance it frequently arises from non-stationary price levels. Two completely unrelated assets that both trend upward over twenty years—such as U.S. technology stocks and global cumulative rainfall or consumer price indexes—can exhibit a price-level correlation above +0.90+0.90. To test genuine co-movement, technicians generally compute correlation on aligned return series (and assess stationarity and stability) (percentage or logarithmic period-over-period changes) rather than raw price levels.
  2. Regime Breakdown: Asset correlations are not fixed constants. During sudden liquidity panics and risk-off crashes, correlations across normally distinct risky assets—equities, high-yield corporate bonds, commodities, and international markets—may rise. Such regime changes can reduce diversification benefits precisely when a portfolio needs protection.

Simple Linear Regression and Beta

While correlation measures symmetric co-movement, simple linear regression models a directional relationship in which an independent variable XX (such as market index returns) explains a dependent variable YY (such as an individual stock's returns):

Y=α+βX+εY = \alpha + \beta X + \varepsilon

Here α\alpha is the intercept, β\beta is the slope coefficient, and ε\varepsilon is the residual error term representing unexplained, asset-specific variation. Ordinary least squares (OLS) minimizes the sum of squared residuals and estimates the slope and intercept as:

β=Cov(X,Y)Var(X)=r⋅sYsX,α=Yˉ−βXˉ\beta = \frac{\text{Cov}(X, Y)}{\text{Var}(X)} = r \cdot \frac{s_Y}{s_X}, \qquad \alpha = \bar{Y} - \beta \bar{X}

Coefficient of Determination (R2R^2)

In ordinary least squares simple linear regression with an intercept, the coefficient of determination (R2R^2) equals the square of Pearson's correlation (R2=r2R^2 = r^2) and ranges from 00 to 11. It specifies the proportion of total variance in YY explained by linear variation in XX. For example, if a stock's return correlation with the S&P 500 is r=0.80r = 0.80, then R2=0.802=0.64R^2 = 0.80^2 = 0.64: 64%64\% of the sample variation in stock returns is accounted for by the fitted linear relationship; the remaining 36%36\% (1−R21 - R^2) is unexplained by that regression (not necessarily purely company-specific risk).

Beta as Systematic Sensitivity

When XX represents a broad market benchmark, the regression slope beta (β\beta) measures systematic market sensitivity:

  • β=1.0\beta = 1.0: Moves in line with the market on average.
  • β>1.0\beta > 1.0 (Aggressive): Amplifies market swings. If Cov(Ri,Rm)=0.036\text{Cov}(R_i, R_m) = 0.036 and Var(Rm)=0.024\text{Var}(R_m) = 0.024, then β=0.0360.024=1.50\beta = \frac{0.036}{0.024} = 1.50, meaning a 1%1\% market move corresponds on average to a 1.5%1.5\% move in the stock.
  • 0<β<1.00 < \beta < 1.0 (Lower positive sensitivity): Dampens market swings (typical of utilities or consumer staples, e.g., β=0.60\beta = 0.60).
  • β<0\beta < 0: Moves inversely to the benchmark (such as inverse exchange-traded products).

Linear Regression Trend Channels

Technicians also apply simple linear regression directly to price charts by setting time tt as the independent variable XX and closing price PtP_t as YY. The resulting linear regression line plots the best-fit trend centerline, while its slope expresses trend velocity in price units per bar. Flanking that centerline at ±1\pm 1 or ±2\pm 2 standard errors of the estimate (SEE) forms a standard error channel; a Raff regression channel instead uses the greatest distance from the fitted line to the selected period’s intrabar highs or lows as its symmetric width. Both can help traders visualize trend persistence and spot statistically stretched extensions.


Hypothesis Testing Basics and Data Snooping

When backtesting a technical rule—such as a moving-average crossover—a positive average return in historical data could simply be luck. Hypothesis testing formalizes whether observed performance is statistically distinguishable from random noise.

Core Components

  1. Null Hypothesis (H0H_0): The skeptical baseline assuming no effect or no edge (e.g., mean excess strategy return μexcess=0\mu_{\text{excess}} = 0).
  2. Alternative Hypothesis (HaH_a): The claim being tested (e.g., μexcess>0\mu_{\text{excess}} > 0 or μexcess≠0\mu_{\text{excess}} \ne 0).
  3. Test Statistic and p-value: A standardized score (such as a tt-statistic) measuring how extreme the sample result is under H0H_0. The p-value is the probability of obtaining a test statistic at least as extreme as the observed sample assuming H0H_0 and the statistical model assumptions hold—it is not the probability that H0H_0 is true.
  4. Significance Level (α\alpha): A pre-chosen threshold (commonly α=0.05\alpha = 0.05, or 5%5\%). If p<αp < \alpha under the prespecified rule, reject H0H_0; statistical significance alone does not establish economic value.

Type I vs. Type II Errors

Reality / DecisionFail to Reject H0H_0Reject H0H_0 (p<αp < \alpha)
H0H_0 is True (No Edge)Correct retention (probability at least 1−α1 - \alpha for a valid level-alpha test)Type I Error — False positive (probability at most α\alpha)
H0H_0 is False (True Edge)Type II Error — False negative (probability βerr\beta_{\text{err}})Correct rejection / Power (probability 1−βerr1 - \beta_{\text{err}})
  • Type I Error (False Positive): Rejecting a true null hypothesis—concluding a worthless indicator works and deploying live capital into a losing system.
  • Type II Error (False Negative): Failing to reject a false null hypothesis—discarding a genuinely profitable rule because the sample was too short or noisy.

Caution

Multiple-Testing and Data-Snooping Danger: Testing 100100 independent parameter combinations on pure random noise at α=0.05\alpha = 0.05 yields an expected 100×0.05=5100 \times 0.05 = 5 "statistically significant" strategies by chance alone (a 1−0.95100≈99.4%1 - 0.95^{100} \approx 99.4\% chance of at least one false positive). Exhaustive backtest optimization without out-of-sample validation, walk-forward testing, or multiple-testing penalties (such as the Bonferroni adjustment α/m\alpha / m) turns random noise into overfitted Type I illusions.

Loading diagram...
Hypothesis Testing and Out-of-Sample Validation Workflow for Trading Rules
Test Your Knowledge

A quantitative analyst correlates the daily closing price levels of two unrelated industries over 15 years and obtains r = +0.92, even though their daily percentage returns show r = +0.04. What explains the high price-level correlation?

A

Regime breakdown caused both industries to converge during minor market pullbacks

B

Spurious correlation arising from correlating two non-stationary trending price series rather than stationary returns

C

Bessel's correction inflated the price-level covariance relative to the return covariance

D

High R-squared proves that one industry causes the long-term price trend of the other

Test Your Knowledge

In a simple linear regression of a stock's monthly returns against a broad market index, the covariance between the stock and the index is 0.027, the variance of the index is 0.018, and the correlation coefficient is r = 0.70. What are the stock's beta and R-squared?

A

Beta = 0.67; R-squared = 0.70

B

Beta = 1.50; R-squared = 0.70

C

Beta = 0.70; R-squared = 0.49

D

Beta = 1.50; R-squared = 0.49

Test Your Knowledge

A technician tests 200 moving-average combinations on historical data using a 5% significance threshold (alpha = 0.05) and deploys the single best combination without out-of-sample testing. Which statistical risk is most severe in this scenario?

A

Type II error, because testing 200 rules lowers the chance of rejecting a false null hypothesis

B

Regime breakdown, because moving averages always correlate at +1.0 across asset classes

C

Type I error via data snooping, because selecting from many unadjusted tests inflates false-positive risk

D

Platykurtic distortion, because moving averages eliminate tail risk from the return series

Sections you finish are checked off in the contents.