Teradata Package for R Function Reference | 17.00 - td_lin_reg_evaluator_valib - Teradata Package for R - Look here for syntax, methods and examples for the functions included in the Teradata Package for R.

Teradata® Package for R Function Reference

Product
Teradata Package for R
Release Number
17.00
Published
July 2021
Language
English (United States)
Last Update
2023-08-08
dita:id
B700-4007
NMT
no
Product Category
Teradata Vantage
Linear Regression Evaluator

Description

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) ),
where

  • 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)

Usage

td_lin_reg_evaluator_valib(data, model, ...)

Arguments

data

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

model

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.

Value

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.

Examples


# 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")
print(df)

# 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",
                                          "nbr_children"),
                                response.column="income")
# Print the model.
print(lin_reg_obj$model)

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