plrs.sim {plrs} | R Documentation

## Simulation of a plrs model

### Description

Simulation of a piecewise relationship.
The function has been only implemented for convenience of simulations and R examples.

### Usage

    plrs.sim(n = 80, states = 4, sigma = 01, x = NULL)

### Arguments

`n` | Number of simulated data points
`states` | Number of states for the model
`sigma` | Noise
`x` | Segmented values.

### Details

To be written...

### Author(s)

Gwenael G.R. Leday g.g.r.leday@vu.nl

### Examples

    # Simulate 1-state model
    sim <- plrs.sim(n=80, states=1, sigma=0.5)
    model <- plrs(expr=sim$expr, cghseg=sim$seg, cghcall=sim$cal)
    plot(model)

    # Simulate 2-state model
    sim <- plrs.sim(n=80, states=2, sigma=0.5)
    model <- plrs(expr=sim$expr, cghseg=sim$seg, cghcall=sim$cal)
    plot(model)

    # Simulate 3-state model
    sim <- plrs.sim(n=90, states=3, sigma=0.5)
    model <- plrs(expr=sim$expr, cghseg=sim$seg, cghcall=sim$cal)
    plot(model)

    # Simulate 4-state model
    sim <- plrs.sim(n=80, states=4, sigma=0.5)
    model <- plrs(expr=sim$expr, cghseg=sim$seg, cghcall=sim$cal)
    plot(model)

[Package plrs version 1.27.0 Index]