# intervalsim: Simulate a set of observed intervals In adokter/intRval: Analysis of Time-Ordered Event Data with Missed Observations

## Description

Simulate a set of observed intervals

## Usage

 ```1 2``` ```intervalsim(n = 500, mu = 200, sigma = 40, p = 0.3, fun = "gamma", trunc = c(0, 600), fpp = 0, n.ind = NA, sigma.within = NA) ```

## Arguments

 `n` Number of simulated interval observations. `mu` Mean arrival interval. `sigma` Standard deviation of the arrival interval. `p` Probability to not observe an arrival. `fun` Assumed distribution for the intervals, one of "`normal`" or "`gamma`", corresponding to the Normal and GammaDist distributions `trunc` Observational range of intervals (intervals outside this range won't be observed) `fpp` Baseline proportion of intervals distributed as a random poisson process with mean arrival interval `mu` `n.ind` Number of intervals per group. Ignored without a numeric value for `sigma.within`. `sigma.within` The within-group standard-deviation. When a numeric value is given for `sigma.within`, `sigma` denotes the total (within+between subject) standard deviation

## Details

Simulates the observations process of arrival intervals.

The default is to not differentiate between within- and between-group variance.

If both `n.ind` and `sigma.within` have numeric values, intervals are simulated with separate within-group variation (`sigma.within`) and between-group variation, for groups of size `n.ind`. Intervals belonging to the same group have:

a within-group mean interval length that has been randomly drawn from a distribution with mean `mu` and between-group standard deviation √{sigma^2 - sigma.within^2}

a within-group standard deviation in interval length equal to `sigma.within`

## Value

This function returns a dataframe containing the following:

`interval`

the simulated interval data

`group_id`

a group identifier

## Examples

 ```1 2 3 4``` ```# simulate observed intervals: intervals=intervalsim(n=50,mu=200,sigma=40,trunc=c(0,600),fpp=0.1) # check whether we retrieve the simulation parameters: estinterval(goosedrop\$interval) ```

adokter/intRval documentation built on May 10, 2019, 5:58 a.m.