R: Simulate example data for GAMs

gamSim {mgcv} | R Documentation

## Simulate example data for GAMs

### Description

Function used to simulate data sets to illustrate the use of `gam` and `gamm`. Mostly used in help files to keep down the length of the example code sections.

### Usage

    gamSim(eg=1,n=400,dist="normal",scale=2,verbose=TRUE)

### Arguments

`eg` | numeric value specifying the example required.
`n` | number of data to simulate.
`dist` | character string which may be used to spcify the distribution of the response.
`scale` | Used to set noise level.
`verbose` | Should information about simulation type be printed?

### Details

See the source code for exactly what is simulated in each case.

1. Gu and Wahba 4 univariate term example.

2. A smooth function of 2 variables.

3. Example with continuous by variable.

4. Example with factor by variable.

5. An additive example plus a factor variable.

6. Additive + random effect.

7. As 1 but with correlated covariates.

### Value

Depends on `eg`, but usually a dataframe, which may also contain some information on the underlying truth. Sometimes a list with more items, including a data frame for model fitting. See source code or helpfile examples where the function is used for further information.

### Author(s)

Simon N. Wood simon.wood@r-project.org

### See Also

`gam`, `gamm`

### Examples

    ## see ?gam

[Package mgcv version 1.8-17 Index]