/
apply_regression.Rd
46 lines (36 loc) · 2.28 KB
/
apply_regression.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utilities.R
\name{apply_regression}
\alias{apply_regression}
\title{apply a regression for calibration purposes}
\usage{
apply_regression(
dt,
predict,
nested_model = FALSE,
calculate_error = FALSE,
model_data = model_data,
model_name = model_name,
model_fit = model_fit,
model_params = model_params,
predict_value = pred,
predict_error = pred_se,
predict_range = NULL
)
}
\arguments{
\item{dt}{data table with calibrations}
\item{predict}{which value to calculate, must be the regression's independent variable (regression is applied directly) or one of the independent variables (regression will be automatically inverted).}
\item{nested_model}{whether the model is nested, if TRUE, must also provide \code{model_params}}
\item{calculate_error}{whether to estimate the standard error from the calibration. Stores the result in the new \code{predict_error} column. If the \code{predict} variable is a dependent variable, will do so using the Wald method (as described in \link[investr]{invest}). Note that error calculation for dependent variables slows this function down a fair bit and is therefore disabled by default.}
\item{model_data}{the nested model data column}
\item{model_name}{new column with the model formulae or names if supplied}
\item{model_fit}{the new model objects column}
\item{model_params}{the nested model information (only relevant if \code{nest_model = TRUE})}
\item{predict_value}{the new column in the model_data that holds the predicted value}
\item{predict_error}{the new column in the model_data that holds the error of the predicted value (always created but \code{NA} if \code{calculate_error = FALSE})}
\item{predict_range}{vector of 2 numbers. Only relevant for predicting dependent variables (regression inversion). If provided will be used for finding the solution for the predict variable. By default uses the range observed in the calibration variables. Specifying the \code{predict_range} is usually only necessary if the calibration range must be extrapolated significantely.}
}
\description{
this function can predict dependent variables (y) from calibration regressions as well as independent variables (xs) by regression inversion for single and multi-variate linear regressions
}