Description
Least Angle Regression (LAR) and its most important modification,
least absolute shrinkage and selection operator (LASSO), are variants
of linear regression that select the most important variables, one by
one, and fit the coefficients dynamically.
The function generates a model that the function td_lar_predict_mle
uses to make predictions for the response variables.
Usage
td_lar_mle (
formula = NULL,
data = NULL,
type = "LASSO",
max.steps = NULL,
normalize = TRUE,
intercept = TRUE,
data.sequence.column = NULL
)
Arguments
formula |
Required Argument. |
data |
Required Argument. |
type |
Optional Argument. |
max.steps |
Optional Argument. |
normalize |
Optional Argument. |
intercept |
Optional Argument. |
data.sequence.column |
Optional Argument. |
Value
Function returns an object of class "td_lar_mle" which is a named
list containing objects of class "tbl_teradata".
Named list members can be referenced directly with the "$" operator
using the following names:
output.table
sql.stdout
Examples
# Get the current context/connection
con <- td_get_context()$connection
# Load example data.
# This input is diabetes data from "Least Angle Regression," by Bradley Efron and others.
# This data set is atypical in that each predictor has mean 0 and norm 1
loadExampleData("lar_example", "diabetes")
# Create object(s) of class "tbl_teradata".
diabetes <- tbl(con, "diabetes")
# Rename columns in the tbl_teradata to lower case, since the input tbl_teradata
# contains one or more column names in upper case.
diabetes_lower <- diabetes %>% rename_all(tolower)
# Example - Build a LAR model with response variable 'y' and ten baseline predictors.
td_lar_out <- td_lar_mle(formula = (y ~ hdl + glu + ldl + map1 + sex + tch + age + ltg
+ bmi + tc),
data = diabetes_lower,
type = "LAR",
max.steps = 20,
intercept = TRUE
)