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 |
model |
Integer. Either |
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 |
method |
Different types of covariance kernels. Possible options are "
"
or "
. |
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="")