create_APCsummary {APCtools}R Documentation

Create a summary table for multiple estimated GAM models

Description

Create a table to summarize the overall effect strengths of the age, period and cohort effects for models fitted with gam or bam. The output format can be adjusted by passing arguments to kable via the ... argument.

Usage

create_APCsummary(model_list, dat, digits = 2, apc_range = NULL, ...)

Arguments

model_list

A list of regression models estimated with gam or bam. If the list is named, the names are used as labels. Can also be a single model object instead of a list.

dat

Dataset with columns period and age. If y_var is specified, the dataset must contain the respective column. If model is specified, the dataset must have been used for model estimation with gam or bam.

digits

Number of digits for numeric columns. Defaults to 2.

apc_range

Optional list with one or multiple elements with names "age","period","cohort" to filter the data. Each element should contain a numeric vector of values for the respective variable that should be kept in the data. All other values are deleted before producing the table.

...

Optional additional arguments passed to kable.

Details

If the model was estimated with a log or logit link, the function automatically performs an exponential transformation of the effect.

Value

Table created with kable.

Author(s)

Alexander Bauer alexander.bauer@stat.uni-muenchen.de

Examples

library(APCtools)
library(mgcv)

data(travel)

# create the summary table for one model
model_pure <- gam(mainTrip_distance ~ te(age, period), data = travel)
create_APCsummary(model_pure, dat = travel)

# create the summary table for multiple models
model_cov  <- gam(mainTrip_distance ~ te(age, period) + s(household_income),
                  data = travel)
model_list <- list("pure model"      = model_pure,
                   "covariate model" = model_cov)
create_APCsummary(model_list, dat = travel)


[Package APCtools version 1.0.4 Index]