Learn R Programming

tuts (version 0.1.1)

simtuts: Generating time-uncertain time series

Description

simtuts function generates time-uncertain time series. It returns two data frames containing simulation of an actual process and its observations. The actual process consists of a sum of a constant, a linear trend, and three sine and three cosine functions, and its observations are normally distributed y.obs~N(y.act, y.sd). Timing of simulated processes is modeled as t.act~U(0,N) and sorted in the ascending order. Observations of timings are modeled in two ways:

  1. Normally distributed timing t.obs.norm~N(ti.act,ti.sd), sorted from the smallest to the largest value to ensure non-overlapping feature of observations,

  2. Timing simulated with truncated normal distribution t.obs.tnorm~N(ti.act,ti.sd,....).

Note: variability of timing can be substantially greater when the normal distribution is chosen, the truncated distribution utilizes enforced limits applied in the midpoints of the actual timing.

Usage

simtuts(N, Harmonics, sin.ampl, cos.ampl, trend = 0, y.sd, ti.sd)

Arguments

N

A number of observations.

Harmonics

A vector of three harmonics, typically integers.

sin.ampl

A vector of three amplitudes of the sine terms.

cos.ampl

vector of three amplitudes of the cosine terms.

trend

A constant trend.

y.sd

A standard deviation of observations.

ti.sd

A standard deviation of estimates of timing.

References

https://en.wikipedia.org/wiki/Truncated_normal_distribution

Examples

Run this code
# NOT RUN {
# 1. Generate actual and observed time series as a sum of 2 sine functions:
DATA=simtuts(N=50,Harmonics=c(10,20,0), sin.ampl=c(10,10, 0), cos.ampl=c(0,0,0),trend=0,
y.sd=2, ti.sd=0.3)

# }

Run the code above in your browser using DataLab