Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

datagen

Generate data over the range of variables used in smooths


Description

For each smooth in a GAM, generate new data over the range of the variables involved in a smooth.

Usage

datagen(x, ...)

## S3 method for class 'mgcv.smooth'
datagen(x, n = 100, data, ...)

## S3 method for class 'fs.interaction'
datagen(x, n = 100, data, ...)

## S3 method for class 'gam'
datagen(x, smooth = NULL, n = 200, ...)

## S3 method for class 'gamm'
datagen(x, ...)

## S3 method for class 'list'
datagen(x, ...)

Arguments

x

an object for which new data is required. Currently objects of classes "gam", and "gamm" are supported, as are smooths from mgcv inheriting from class "mgcv.smooth".

...

arguments passed to methods

n

numeric; the number of data values to generate per term in each smooth.

data

data frame; for "mgcv.smooth" objects, the data used to fit the GAM need to be supplied.

Value

A data frame of new values spread over the range of the observed values.

Author(s)

Gavin L. Simpson


gratia

Graceful 'ggplot'-Based Graphics and Other Functions for GAMs Fitted Using 'mgcv'

v0.6.0
MIT + file LICENSE
Authors
Gavin L. Simpson [aut, cre] (<https://orcid.org/0000-0002-9084-8413>), Henrik Singmann [ctb] (<https://orcid.org/0000-0002-4842-3657>)
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.