mrct.rgauss: Random sample from Gaussian process

View source: R/mrct_functions.R

mrct.rgaussR Documentation

Random sample from Gaussian process

Description

Generate random samples of Gaussian process on a uniform grid for different settings of the simulation study in \insertCiteoguamalam2023minimum;nobracketsmrct.

Usage

mrct.rgauss(
  x.grid,
  N,
  seed = 123,
  model,
  outliers,
  sigma = 1,
  l = 1,
  method = "linear"
)

Arguments

x.grid

Numeric vector containing a uniform grid on which the process is defined.

N

Integer number of observations to generate.

seed

Integer (default is 123).. Random seed for reprocudibility.

model

Integer. Either 1, 2 or 3. Corresponds to one of the three simulation settings.

outliers

Integer vector containing the indices of outliers. If empty, then only regular curves will be generated.

sigma, l

Numeric values with default equal to 1. Parameters for the covariance kernel.

method

Different types of covariance kernels. Possible options are "quadratic"

\gamma(s,t) = \sigma \text{exp}\left(\frac{-(s-t)^2}{l}\right),

"linear"

\gamma(s,t) = \sigma \text{exp}\left(\frac{-|s-t|}{l}\right)

or "gaussian" (default)

\gamma(s,t) = \sigma^2 \text{exp}\left(\frac{-(s-t)^2}{2 l^2}\right)

.

Value

Numeric matrix with N rows and length(x.grid) columns containing the randomly generated curves following a Gaussian process. Each observations is a row of the result.

References

\insertRef

oguamalam2023minimummrct.

Examples

# Fix seed for reproducibility
set.seed(123)

# Sample outlying indices
cont.ind <- sample(1:50,size=10)

# Generate 50 curves on the interval [0,1] at 50 timepoints with 20% outliers
y <- mrct.rgauss(x.grid=seq(0,1,length.out=50), N=50 ,model=1,
                 outliers=cont.ind)

# Visualize curves (regular curves grey, outliers black)
colormap <- rep("grey",50); colormap[cont.ind] <- "black"
matplot(x=seq(0,1,length.out=50), y=t(y), type="l", lty="solid",
        col=colormap, xlab="t",ylab="")

mrct documentation built on Aug. 17, 2023, 5:18 p.m.

Related to mrct.rgauss in mrct...