simgamdata {blapsr}R Documentation

Simulation of data for (Generalized) additive models.

Description

Simulation of a data set that can be used to illustrate the amlps or gamlps routines to fit (generalized) additive models with the Laplace-P-spline methodology.

Usage

simgamdata(setting = 1, n, dist = "gaussian", scale = 0.5, info = TRUE)

Arguments

setting

The simulation setting. The default is setting = 1 for a setting with three smooth terms, while setting = 2 is another setting with only two smooth terms. The coefficients of the linear part of the predictor are also different in the two settings.

n

The sample size to simulate.

dist

A character string to specify the response distribution. The default is "gaussian". Other distributions can be "poisson", "bernoulli" and "binomial".

scale

Used to tune the noise level for Gaussian and Poisson distributions.

info

Should information regarding the simulation be printed? Default is true.

Details

The simulation settings contain two covariates in the linear part of the predictor, namely z1 ~ Bern(0.5) and z2 ~ N(0,1). The smooth additive terms are inspired from Antoniadis et al. (2012). For Binomial data, the number of trials is fixed to 15.

Value

An object of class simgam. Plot of a simgam object yields a scatter plot of the generated response values.

data

A data frame.

f

The true smooth functions.

betas

The regression coefficients of the linear part. The first term is the intercept.

dist

The distribution of the response.

Author(s)

Oswaldo Gressani oswaldo_gressani@hotmail.fr.

References

Antoniadis, A., Gijbels, I., and Verhasselt, A. (2012). Variable selection in additive models using P-splines. Technometrics 54(4): 425-438.

Examples

set.seed(10)
sim <- simgamdata(n = 150, dist = "poisson", scale = 0.3)
plot(sim)


[Package blapsr version 0.6.1 Index]