data_sim: Simulate example data for fitting GAMs

data_simR Documentation

Simulate example data for fitting GAMs

Description

A tidy reimplementation of the functions implemented in mgcv::gamSim() that can be used to fit GAMs. An new feature is that the sampling distribution can be applied to all the example types.

Usage

data_sim(
  model = "eg1",
  n = 400,
  scale = 2,
  theta = 3,
  dist = c("normal", "poisson", "binary", "negbin", "tweedie"),
  seed = NULL
)

Arguments

model

character; either "egX" where X is an integer 1:7, or the name of a model. See Details for possible options.

n

numeric; the number of observations to simulate.

scale

numeric; the level of noise to use.

theta

numeric; the dispersion parameter θ to use. The default is entirely arbitrary, chosen only to provide simulated data that exhibits extra dispersion beyond that assumed by under a Poisson.

dist

character; a sampling distribution for the response variable.

seed

numeric; the seed for the random number generator. Passed to base::set.seed().

Examples


data_sim("eg1")


gratia documentation built on Feb. 16, 2023, 10:40 p.m.