Sub topic 14
Continuous X and Continuous Y: Correlation and Regression
When this approach fits
Assume you already know basic descriptive statistics, DMAIC, histograms, box plots, and the difference between a sample and a population. In this chapter, both the input, or X, and the output, or Y, are continuous measurements. Continuous data can take values across a range, such as temperature, cycle time, pressure, or defect size.
Use correlation and regression when you want to learn whether changes in a measured input are associated with changes in a measured output. For example, a team may ask whether oven temperature is related to curing time.
Correlation measures the strength and direction of a linear relationship. Regression describes that relationship with an equation and can estimate Y for a chosen value of X.
Correlation and its hypothesis test
The Pearson correlation coefficient, written as r, ranges from -1 to 1:
rnear 1 means a strong positive linear relationship.rnear -1 means a strong negative linear relationship.rnear 0 means little linear relationship.
For a significance test, state the hypotheses before looking at the result:
- H0: The population correlation is zero,
ρ = 0. - H1: The population correlation is not zero,
ρ ≠ 0.
A small p-value suggests that the observed relationship would be unusual if the population correlation were zero. It does not prove that X causes Y.
Simple linear regression
Simple linear regression models one output from one input:
\[ Y = \beta0 + \beta1X + \epsilon \]
Here, β0 is the intercept, β1 is the expected change in Y for a one-unit increase in X, and ε represents unexplained variation.
The regression test usually asks:
- H0:
β1 = 0; X does not have a linear association with Y. - H1:
β1 ≠ 0; X has a linear association with Y.
The slope is often more useful to a project team than the p-value. A slope of 0.8 means that Y is estimated to increase by 0.8 units for each one-unit increase in X, within the observed data range.
Assumptions and common errors
Check a scatterplot before calculating a coefficient. A curved pattern can have a correlation near zero even when X strongly predicts Y. Check regression residuals for unequal spread, nonlinearity, and unusual observations. Observations should also be independent. Repeated measurements from the same item may require a different model.
| Check | Why it matters | Warning sign |
|---|---|---|
| Linearity | Regression estimates a straight-line relationship | Curved scatterplot |
| Constant variance | Standard errors and intervals depend on stable spread | Funnel-shaped residual plot |
| Independence | Tests assume observations do not influence one another | Time-order or repeated-unit patterns |
| Influential points | One observation can change the slope greatly | Slope changes when a point is removed |
Worked example in Python
import numpy as np
from scipy import stats
temperature = np.array([180, 185, 190, 195, 200, 205, 210, 215])
cure_time = np.array([42, 40, 39, 37, 36, 34, 33, 31])
correlation = stats.pearsonr(temperature, cure_time)
model = stats.linregress(temperature, cure_time)
print("r =", correlation.statistic)
print("correlation p-value =", correlation.pvalue)
print("slope =", model.slope)
print("intercept =", model.intercept)
print("regression p-value =", model.pvalue)
print("R-squared =", model.rvalue ** 2)The slope should be negative, indicating that higher temperature is associated with shorter cure time. R-squared estimates the proportion of variation in Y explained by the linear model. Treat that value as a description of these data, not proof that the model will work outside the observed temperature range.
Exercise
A regression has a slope of -0.4 minutes per degree Celsius and a p-value of 0.02. What can you conclude at α = 0.05?
Show answer
Reject H0: β1 = 0. The data provide evidence of a negative linear association. Each additional degree Celsius is associated with an estimated 0.4-minute decrease in cure time, but the result does not prove that temperature alone causes the decrease.