Description
The generalized linear model (GLM) is an extension of the linear
regression model that enables the linear equation to be related to
the dependent variables by a link function. GLM performs linear
regression analysis for distribution functions using a userspecified
distribution family and link function. GLM selects the link function
based upon the distribution family and the assumed nonlinear
distribution of expected outcomes. The table in background describes
the supported link function combinations.
Usage
td_glm_mle (
formula = NULL,
family = "gaussian",
linkfunction = "CANONICAL",
data = NULL,
weights = "1.0",
threshold = 0.01,
maxit = 25,
step = FALSE,
intercept = TRUE,
data.sequence.column = NULL
)
Arguments
formula 
Required Argument.
An object of class "formula". Specifies the model to be fitted. Only
basic formula of the (col1 ~ col2 + col3 +...) form are supported and
all variables must be from the same tbl_teradata object. The
response should be column of type numeric or logical.

family 
Optional Argument.
Specifies the distribution exponential family.
Default Value: "gaussian"
Permitted Values: LOGISTIC, BINOMIAL, POISSON, GAUSSIAN, GAMMA,
INVERSE_GAUSSIAN, NEGATIVE_BINOMIAL
Types: character

linkfunction 
Optional Argument.
Specifies the canonical link functions (default link functions) and the link
functions that are allowed.
Default Value: "CANONICAL"
Permitted Values: CANONICAL, IDENTITY, INVERSE, LOG,
COMPLEMENTARY_LOG_LOG, SQUARE_ROOT, INVERSE_MU_SQUARED, LOGIT,
PROBIT, CAUCHIT
Types: character

data 
Required Argument.
Specifies the name of the tbl_teradata that contains the columns.

weights 
Optional Argument.
Specifies the name of an input tbl_teradata column that contains the
weights to assign to responses. You can use nonNULL weights to
indicate that different observations have different dispersions
(with the weights being inversely proportional to the
dispersions). Equivalently, when the weights are positive
integers wi, each response yi is the mean of wi unitweight
observations. A binomial GLM uses prior weights to give the number of
trials when the response is the proportion of successes. A Poisson
GLM rarely uses weights. If the weight is less than the response
value, then the function throws an exception. Therefore, if the
response value is greater than 1 (the default weight), then you must
specify a weight that is greater than or equal to the response value.
Default Value: "1.0"
Types: character

threshold 
Optional Argument.
Specifies the convergence threshold.
Default Value: 0.01
Types: numeric

maxit 
Optional Argument.
Specifies the maximum number of iterations that the algorithm runs
before quitting, if the convergence threshold is not met.
Default Value: 25
Types: integer

step 
Optional Argument.
Specifies whether the function uses a step. If the function uses a
step, then it runs with the GLM model that has the lowest Akaike
information criterion (AIC) score, drops one predictor from the
current predictor group, and repeats this process until no predictor
remains.
Default Value: FALSE
Types: logical

intercept 
Optional Argument.
Specifies whether the function uses an intercept. For example, in
B0+B1*X1+B2*X2+ ....+BpXp, the intercept is B0.
Default Value: TRUE
Types: logical

data.sequence.column 
Optional Argument.
Specifies the vector of column(s) that uniquely identifies each row
of the input argument "data". The argument is used to ensure
deterministic results for functions which produce results that vary
from run to run.
Types: character OR vector of Strings (character)

Value
Function returns an object of class "td_glm_mle" which is a named
list containing objects of class "tbl_teradata".
Named list members can be referenced directly with the "$" operator
using following names:
coefficients
output
Examples
# Get the current context/connection
con < td_get_context()$connection
# Load example data.
loadExampleData("glm_example", "admissions_train", "housing_train")
# Create object(s) of class "tbl_teradata".
admissions_train < tbl(con, "admissions_train")
housing_train < tbl(con, "housing_train")
# Example 1 
td_glm_out1 < td_glm_mle(formula = (admitted ~ stats + masters + gpa + programming),
family = "LOGISTIC",
linkfunction = "LOGIT",
data = admissions_train,
weights = "1",
threshold = 0.01,
maxit = 25,
step = FALSE,
intercept = TRUE
)
# Example 2 
td_glm_out2 < td_glm_mle(formula = (admitted ~ stats + masters + gpa + programming),
family = "LOGISTIC",
linkfunction = "LOGIT",
data = admissions_train,
weights = "1",
threshold = 0.01,
maxit = 25,
step = TRUE,
intercept = TRUE
)
# Example 3 
td_glm_out3 < td_glm_mle(formula = (price ~ recroom + lotsize + stories + garagepl + gashw
+ bedrooms + driveway + airco + homestyle + bathrms + fullbase
+ prefarea),
family = "GAUSSIAN",
linkfunction = "IDENTITY",
data = housing_train,
weights = "1",
threshold = 0.01,
maxit = 25,
step = FALSE,
intercept = TRUE
)