run_regression(dt, model, nest_model = FALSE, min_n_datapoints = 1,
model_data = model_data, model_filter_condition = NULL,
model_name = model_name, model_enough_data = model_enough_data,
model_fit = model_fit, model_range = model_range,
model_coefs = model_coefs, model_summary = model_summary,
model_params = model_params, residual = residual)

## Arguments

dt |
data table |

model |
the regression model or named list of regression models. If a named list is provided, the name(s) will be stored in the `model_name` column instead of the formula. |

nest_model |
whether to nest the model outcome columns (for easier use in multi model systems), default is FALSE |

min_n_datapoints |
the minimum number of data points required for applying the model(s). Note that there is always an additional check to make sure the minimum number of degrees of freedom for each model is met. If the minimum number of degrees of freedom required is not met, the model will/can not be calculated no matter what `min_n_datapoints` is set to. |

model_data |
the nested model data column |

model_filter_condition |
a filter to apply to the data before running the regression (if only a subset of the data is part of the calibration data), by default no filter |

model_name |
new column with the model formulae or names if supplied |

model_enough_data |
new column with information on whether the model has enough data (based on the required degrees of freedom for the model) |

model_fit |
the new model objects column |

model_range |
the range of each variable in the model |

model_coefs |
the new model coefficients nested data frame column |

model_summary |
the new model summary nested data frame column |

model_params |
the nested model information (only relevant if `nest_model = TRUE` ) |

residual |
name of the new residual column in the nested model_data - residuals are only calculated for rows that are part of the regression (as determined by `model_filter_condition` ) |