designmatrisen
The designmatrisen, or design matrix, is a mathematical object used in statistical modeling to organize the predictor variables for a set of observations. It maps each observation to a row and each predictor to a column, so that the linear predictor β is obtained by multiplying the design matrix by the coefficient vector.
In a linear regression model y = Xβ + ε, X is the design matrix with n rows (observations)
Key formulas: the ordinary least squares estimate is β_hat = (X^T X)^{-1} X^T y, provided X^T X is
Properties: the rank and conditioning of X affect identifiability and numerical stability. Multicollinearity (near-dependencies among columns)
Applications: design matrices are central to ordinary least squares, ANOVA, and generalized linear models; they appear
Example: for y = β0 + β1 x1 + β2 x2, with intercept, X = [[1, x11, x12], [1, x21,