Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rproc2fdata

Simulate several random processes.


Description

Simulate Functional Data from different processes: Ornstein Uhlenbeck, Brownian, Fractional Brownian, Gaussian or Exponential variogram.

Usage

rproc2fdata(
  n,
  t = NULL,
  mu = rep(0, length(t)),
  sigma = 1,
  par.list = list(scale = 1, theta = 0.2 * diff(rtt), H = 0.5),
  norm = FALSE,
  verbose = FALSE,
  ...
)

Arguments

n

Number of functional curves to be generated.

t

Discretization points.

mu

vector which specifies the trend values at the discretization points, by default mu=μ(t)=0. If mu is a fdata class object, t=argvals(mu).

sigma

A positive-definite symmetric matrix, Σ, specifying the covariance matrix among grid points. If sigma is a scalar, creates a random Gaussian process with Σ=sigmaI (by default sigma=1).
If sigma is a vector, creates a random Gaussian process with Σ=diag(sigma).
If sigma is a character: create a random process using the covariance matrix Σ indicated in the argument,

  • "OU" or "OrnsteinUhlenbeck", creates a random Ornstein Uhlenbeck process with Σ(s,t)=σ^2/θ exp(-θ(s+t))(exp(2θ(s+t)-1)), by default θ=1/(3range(t)), σ^2=1.

  • "brownian" or "wiener", creates a random Wiener process with Σ(s,t)=σ^2 min(s,t), by default σ^2=1.

  • "fbrownian", creates a random fractional brownian process with Σ(s,t)=σ^{2H}/2{|s|^{2H}+|t|^{2H}-|s-t|^{2H}}, by default σ^2=1 and H=0.5 (brownian process).

  • "vexponential", creates a random gaussian process with exponential variogram Σ=σ^2 exp(-|s-t|/θ ), by default θ=.2*range(t), σ^2=1.

par.list

List of parameter to process, by default "scale" σ^2=1, "theta" θ=0.2 range(t) and "H"=0.5.

norm

If TRUE the norm of random projection is 1. Default is FALSE

verbose

If TRUE, information about procedure is printed. Default is FALSE.

...

Further arguments passed to or from other methods.

Value

Return the functional random processes as a fdata class object.

Author(s)

Manuel Febrero-Bande, Manuel Oviedo de la Fuente manuel.oviedo@usc.es

Examples

## Not run: 
par(mfrow=c(3,2))
lent<-30
tt<-seq(0,1,len=lent)
mu<-fdata(rep(0,lent),tt)
plot(rproc2fdata(200,t=tt,sigma="OU",par.list=list("scale"=1)))
plot(rproc2fdata(200,mu=mu,sigma="OU",par.list=list("scale"=1)))
plot(rproc2fdata(200,t=tt,sigma="vexponential"))
plot(rproc2fdata(200,t=tt,sigma=1:lent))
plot(rproc2fdata(200,t=tt,sigma="brownian"))
plot(rproc2fdata(200,t=tt,sigma="wiener"))
#plot(rproc2fdata(200,seq(0,1,len=30),sigma="oo")) # this is an error 

## End(Not run)

fda.usc

Functional Data Analysis and Utilities for Statistical Computing

v2.0.2
GPL-2
Authors
Manuel Febrero Bande [aut], Manuel Oviedo de la Fuente [aut, cre], Pedro Galeano [ctb], Alicia Nieto [ctb], Eduardo Garcia-Portugues [ctb]
Initial release
2020-02-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.