intervalsim {intRvals} | R Documentation |
Simulate a set of observed intervals
Description
Simulate a set of observed intervals
Usage
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 " |
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 |
n.ind |
Number of intervals per group. Ignored without a numeric value for |
sigma.within |
The within-group standard-deviation. When a numeric value is given for |
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\sqrt{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
# 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)