fix_offset: Fix the names of a data frame containing an offset variable.

Description Usage Arguments Value Author(s) Examples

Description

Identifies which variable, if any, is the model offset, and fixed the name such that "offset(foo(var))" is converted"var", and possibly sets that data tooffset_value'.

Usage

1
fix_offset(model, newdata, offset_value = NULL)

Arguments

model

a fitted GAM.

newdata

data frame; new values at which to predict at.

offset_value

numeric, optional; if provided, then the offset variable in newdata is set to this constant value before returning newdata

Value

The original newdata is returned with fixed names and possibly modified offset variable.

Author(s)

Gavin L. Simpson

Examples

1
2
3
4
5
6
7
##\testonly{set.seed(2)}
library("mgcv")
set.seed(2)
df <- gamSim(1, n = 400, dist = "normal")
m <- gam(y ~ s(x0) + s(x1) + offset(x0), data = df, method = "REML")
names(model.frame(m))
names(fix_offset(m, model.frame(m), offset_value = 1L))

gavinsimpson/schoenberg documentation built on May 28, 2019, 8:43 a.m.