idaGlm {ibmdbR} | R Documentation |
Generalized Linear Models (GLM)
Description
This function computes generalized linear models on the contents of an ida.data.frame
.
Usage
idaGlm( form, data, id = "id", intercept = T, family = "bernoulli", family_param = -1,
link = "logit", link_param = 1, maxit = 20, eps = 1e-3, tol = 1e-7,
method = "irls", trials = NULL, incolumn = "", interaction = "",
modelname = NULL, format = "glm", raw.resid = F, dropAfter = F, ...)
## S3 method for class 'idaGlm'
print(x, ...)
## S3 method for class 'idaGlm'
predict(object, newdata, id, outtable = NULL, ...)
Arguments
form |
A |
data |
An |
id |
The ID column name. |
intercept |
The intercept. |
family |
The type of error distribution. It can have one of the follwing values: "bernoulli", "gaussian", "poisson", "binomial", "negativebinomial", "wald", "gamma" |
family_param |
A family-specific parameter. |
link |
Type of the link function. It can have one of the follwoing values: |
"clog", "cloglog", "gaussit", "identity", "log", "logit", "oddspower", "power", "probit", and "sqrt". For Db2 for z/OS it can have the following values as well: "canbinom", "cangeom", "cannegbinom", "cauchit", "inverse", "invnegative", "invsquare", "loglog" .
link_param |
Link parameter, 1 by default. |
maxit |
Maximum number of iterations. 20 by default. |
eps |
Maximum (relative) error used as a stopping criterion. This should be sufficiently small for the algorithm to work. |
tol |
The tolerance for the linear equation solver to consider a value equal to be zero. This should be sufficiently small for the algorithm to work. |
method |
Computing algorithm: either |
trials |
The input table column containing the number of trials for the binominal distribution. Ignored unless family is 'binomial'. |
incolumn |
Overwrite automatic creation of incolumn parameter and specify your own incolumn here. |
interaction |
Overwrite automatic creation of interaction parameter and specify your own interaction here. |
modelname |
Name of the model that will be created in the database. Will be created automatically if not specified. |
format |
Specify output format. Either |
raw.resid |
If |
dropAfter |
Whether to drop the results after downloading them as specified in |
x |
An |
object |
An |
newdata |
New data used for prediction as |
outtable |
The name of the table the results will be written in. |
... |
Additional parameters. |
Details
For more details on the GLM algorithm and requirements to the data
, please refer to
the documentation of the nza..GLM
stored procedure in the Netezza
In-Database Analytics Reference Guide or Netezza In-Database Analytics Developers Guide.
Value
The function
idaGlm
returns the generalized linear regression model of classesglm
andidaGlm
ifformat
equals"glm"
or alist
ofdata.frame
s ifformat
equals"raw"
.The functions
print
andsummary
have no return values.The function
predict
returns anida.data.frame
that contains the predicted values.
Examples
## Not run:
#Add isSetosa column to iris data frame
iris2 <- iris
iris2$isSetosa <- ifelse(iris2$Species=="setosa", 1, 0)
#Store the iris2 data frame in the IRIS2 table
idf <-as.ida.data.frame(iris2, table="IRIS2", clear.existing=T, rownames="ID")
#Calculate GLM model in-db
glm <- idaGlm(isSetosa~PetalLength+SepalLength*SepalWidth+PetalWidth, idf, id="ID")
#Print the model
print(glm)
#Apply the model to data
idf2 <- predict(glm, idf, "ID")
#Inspect the results
head(idf2)
## End(Not run)