Learn R Programming

tswge (version 2.1.0)

gen.sigplusnoise.wge: Generate data from a signal-plus-noise model

Description

Generate a realization from the model x(t)=coef[1]*cos(2*pi*freq[1]*t+psi[1])+coef[2]*cos(2*pi*freq[2]*t+psi[2])+a(t)

Usage

gen.sigplusnoise.wge(n,b0,b1=0,coef,freq,psi,phi=0,vara=1,plot=TRUE,sn=0)

Value

x

realization generated

Arguments

n

length of realization to be generated

b0

y intercept of the linear component

b1

slope of the linear component

coef

a 2-component vector specifying the coefficients (if only one cosine term is desired define coef[2]=0)

freq

a 2-component vector specifying the frequency components (0 to .5)

psi

a 2-component vector specifying the phase shift (0 to 2pi)

phi

a vector of coefficients of the coefficients of the AR noise

vara

vara is the variance of the noise. NOTE: a(t) is a vector of N(0,WNV) noise generated within the function (default=1)

plot

if TRUE then plot the data generated (default=TRUE)

sn

determines the seed used in the simulation (default=0 indicating new realization each time). sn=positve integer, then the same realization is generated each time

Author

Wayne Woodward

References

Applied Time Series Analysis with R, second edition by Woodward, Gray, and Elliott

Examples

Run this code
x=gen.sigplusnoise.wge(n=100,coef=c(3,1),freq=c(.1,.4),psi=c(0,0),vara=2)

Run the code above in your browser using DataLab