Learn R Programming

PivotalR (version 0.1.18.5)

AIC: AIC methods for Madlib regression objects

Description

Functions to extract the AIC and log-likelihood for regression models fit in Madlib.

Usage

# S3 method for lm.madlib
extractAIC(fit, scale=0, k=2, ...)
    # S3 method for lm.madlib.grps
extractAIC(fit, scale=0, k=2, ...)
    # S3 method for lm.madlib
logLik(object, ...)
    # S3 method for lm.madlib.grps
logLik(object, ...)
    # S3 method for lm.madlib.grps
AIC(object, ..., k=2)

# S3 method for logregr.madlib extractAIC(fit, scale=0, k=2, ...) # S3 method for logregr.madlib.grps extractAIC(fit, scale=0, k=2, ...) # S3 method for logregr.madlib logLik(object, ...) # S3 method for logregr.madlib.grps logLik(object, ...) # S3 method for logregr.madlib.grps AIC(object, ..., k=2)

# S3 method for glm.madlib extractAIC(fit, scale=0, k=2, ...)

# S3 method for glm.madlib.grps extractAIC(fit, scale=0, k=2, ...)

# S3 method for glm.madlib logLik(object, ...)

# S3 method for glm.madlib.grps logLik(object, ...)

# S3 method for glm.madlib.grps AIC(object, ..., k=2)

Arguments

fit, object

The regression model object, of class lm.madlib or logregr.madlib, fit using madlib.lm or madlib.glm respectively.

scale

The scale parameter for the model. Currently unused.

k

Numeric, specifying the equivalent degrees of freedom part in the AIC formula.

...

Other arguments, not used.

Value

For ungrouped regressions, logLik returns an object of class logLik, and extractAIC returns a length-2 numeric vector giving the edf and AIC.

For grouped regressions, logLik and extractAIC return a list giving the output of these methods for each of the component models. Similarly, AIC for a grouped regression returns a vector of the AICs for each of the component models.

Details

See the documentation for AIC and extractAIC.

See Also

AIC, extractAIC, logLik.

Examples

Run this code
# NOT RUN {
 
# }
# NOT RUN {
<!-- %% @test .port Database port number -->
<!-- %% @test .dbname Database name -->
## set up the database connection
## Assume that .port is port number and .dbname is the database name
cid <- db.connect(port = .port, dbname = .dbname, verbose = FALSE)

## create a table
delete("abalone", conn.id = cid)
x <- as.db.data.frame(abalone, "abalone", conn.id = cid, verbose = FALSE)

fit <- madlib.glm(rings < 10 ~ . - id | sex, data = x, family =
"binomial")

AIC(fit)

AIC(fit[[1]])

db.disconnect(cid, verbose = FALSE)
# }

Run the code above in your browser using DataLab