Regression Models API
Complete reference for all 5 regression model types.
OLS (Ordinary Least Squares)
SELECT * FROM anofox_statistics_ols(
table_name, -- Table with data
target_column, -- y (what you predict)
predictor_columns -- ARRAY[x1, x2, ...] (predictors)
);
Output Fields:
coefficient[j]- Regression coefficientsstd_error[j]- Standard errorst_statistic[j]- t-statisticsp_value[j]- p-values for hypothesis testsr_squared- Goodness of fit (0-1)adjusted_r_squared- Penalized for predictorsrmse- Root mean squared erroraic- Akaike Information Criterionbic- Bayesian Information Criterion
Ridge Regression
SELECT * FROM anofox_statistics_ridge(
table_name,
target_column,
predictor_columns,
options -- MAP_CREATE(ARRAY['lambda'], ARRAY['0.5'])
);
Options:
lambda- Regularization strength (0.1 to 10.0)
WLS (Weighted Least Squares)
SELECT * FROM anofox_statistics_wls(
table_name,
target_column,
predictor_columns,
weight_column -- Column with observation weights
);
For heteroscedastic data where variance differs.
RLS (Recursive Least Squares)
SELECT * FROM anofox_statistics_rls(
table_name,
target_column,
predictor_columns,
options -- MAP_CREATE(ARRAY['forgetting_factor'], ARRAY['0.95'])
);
For streaming/online learning with concept drift.
Elastic Net
SELECT * FROM anofox_statistics_elastic_net(
table_name,
target_column,
predictor_columns,
options -- MAP_CREATE(ARRAY['alpha', 'lambda'], ARRAY['0.5', '0.1'])
);
Options:
alpha- L1/L2 balance (0-1)lambda- Regularization strength
Aggregate Versions
All models available with _agg suffix for GROUP BY:
SELECT
group_id,
result.coefficient[2] as effect
FROM data
GROUP BY group_id
APPLY anofox_statistics_ols_agg(y, ARRAY[x1, x2]);
Next Steps
- Inference — Testing and prediction
- Diagnostics — Validation