environmentaltools.spatiotemporal.bme.create_design_matrix
- environmentaltools.spatiotemporal.bme.create_design_matrix(c, order)[source]
Create design matrix for polynomial regression.
Constructs matrix of polynomial terms for spatiotemporal regression, with separate spatial (x, y) and temporal (t) terms.
- Parameters:
c (np.ndarray) – Coordinate matrix of shape (n, 3) with columns [x, y, t].
order (list of int) – Polynomial orders [spatial_order, temporal_order].
- Returns:
x – Design matrix of shape (n, n_terms) where n_terms = 1 + 2*spatial_order + temporal_order. Column 0 is constant term, followed by spatial terms (x, y) up to specified order, then temporal terms up to specified order.
- Return type:
np.ndarray
Notes
Spatial terms alternate between x and y coordinates: [1, x, y, x², y², x³, y³, …]. Temporal terms follow: [t, t², t³, …].