A quadratic term extends a regression model beyond straight-line effects. For parameters x1 and x2, squared terms x1² and x2² represent curvature, while the pairwise product x1x2 models behavior between parameters along diagonals. section 4.2.2
In a two-parameter response-surface model:
- β3x1² and β4x2² allow a maximum to occur inside the parameter range rather than only at its edges. section 4.2.2
- β5x1x2 captures joint behavior between the center and corner measurements of a central-composite design. section 4.2.2
- With d parameters, one quadratic pair term is needed for every parameter pair: d(d−1)/2 terms. section 4.2.2
Trading-parameter optimization
A fitted model using threshold and order_size estimated maximum markout profit at threshold = 1.12 and order_size = 3.0, with estimated profit 0.41. The candidate required a separate validation measurement and 95% confidence check. section 4.2.2
Listing 4.9 Linear regression for two parameters
def linear_regression_2D(parameters, aggregate_measurements):
parameters = np.array(parameters) #1
x0 = parameters[:,0] #2
x1 = parameters[:,1] #3
y = aggregate_measurements
X = np.array([np.ones(len(y)), x0, x1, x0**2, x1**2, x0*x1]).T
beta = np.linalg.inv(X.T @ X) @ (X.T @ y) #4
return beta
The regression design matrix makes the constant, linear, squared, and cross-product terms explicit before fitting coefficients with the normal equation. section 4.2.2
