Teradata Package for R Function Reference | 17.00 - 17.00 - td_lin_reg_evaluator_valib - Teradata Package for R

Teradata® Package for R Function Reference

Teradata Package for R
Release Number
Release Date
July 2021
Content Type
Programming Reference
Publication ID
English (United States)


Linear regression model evaluation begins with scoring an input data that includes the actual values of the dependent variable. The standard error of estimate for the model is calculated and reported and is compared to the standard error of estimate reported when the model was built. The standard error of estimate is calculated as the square root of the average squared residual value over all the observations (as shown below):

standard error of estimate = sqrt( sum((y-y1)**2)/(n-p-1) ),

  • y1 - the actual value of the dependent variable

  • y - the predicted value

  • n - the number of observations

  • p - the number of independent variables (substituting n-p in the denominator if there is no constant term)


td_lin_reg_evaluator_valib(data, model, ...)



Required Argument.
Specifies the input data to evaluate.
Types: tbl_teradata


Required Argument.
Specifies the input containing the linear model to use in evaluation. This must be the "model" tbl_teradata generated by td_lin_reg_valib() or a tbl_teradata created on a table generated by 'linear' function from Vantage Analytic Library.
Types: tbl_teradata


Specifies any other parameters that are required for future purpose.


Function returns an object of class "td_lin_reg_evaluator_valib" which is a named list containing object of class "tbl_teradata".
Named list member can be referenced directly with the "$" operator using name: result.


# Notes:
#   1. To execute Vantage Analytic Library functions, set option
#      'val.install.location' to the database name where Vantage analytic
#      library functions are installed.
#   2. Datasets used in these examples can be loaded using Vantage Analytic
#      Library installer.

# Set the option 'val.install.location'.
options(val.install.location = "SYSLIB")

# Get remote data source connection.
con <- td_get_context()$connection

# Create an object of class "tbl_teradata".
df <- tbl(con, "customer")

# Example 1: Shows how linear regression model evaluation is performed.
# First generate the model using td_lin_reg_valib() function.
lin_reg_obj <- td_lin_reg_valib(data=df,
                                columns=c("age", "years_with_bank",
# Print the model.

# Evaluate the data using the linear regression model generated above.
obj <- td_lin_reg_evaluator_valib(data=df,
# Print the results.