Learn R Programming

itsadug (version 2.4.1)

get_coefs: Get coefficients for the parametric terms (intercepts and random slopes).

Description

Wrapper around the function coef, and loosely based on summary.gam. This function provides a much faster alternative for summary(model)$p.table. The function summary.gam) may take considerably more time for large models, because it additionally needs to calculate estimates for the smooth term table.

Usage

get_coefs(model, se = TRUE)

Arguments

model

A gam object, produced by gam or bam.

se

Logical: whether or not to return the standard errors.

Value

The coefficients of the parametric terms.

See Also

Other Model predictions: get_difference(), get_fitted(), get_modelterm(), get_predictions(), get_random()

Examples

Run this code
# NOT RUN {
data(simdat)

# Condition as factor, to have a random intercept
# for illustration purposes:
simdat$Condition <- as.factor(simdat$Condition)

# Model with random effect and interactions:
m1 <- bam(Y ~ Group * Condition + s(Time),
    data=simdat)

# extract all parametric coefficients:
get_coefs(m1)
# calculate t-values:
test <- get_coefs(m1)
test <- cbind(test, test[,1] / test[,2] )
colnames(test)[3] <- 't-value'
test

# get_coefs returns the same numbers as shown in the parametric summary:
summary(m1)
# get_coefs is based on the function coef. This function returns 
# values of all coefficients, and does not provide SE:
coef(m1)

# }

Run the code above in your browser using DataLab