mrct.rgauss {mrct}R 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 Oguamalam et al. 2023.

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

Oguamalam J, Radojičić U, Filzmoser P (2023). “Minimum regularized covariance trace estimator and outlier detection for functional data.” https://doi.org/10.48550/arXiv.2307.13509..

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="")

[Package mrct version 0.0.1.0 Index]