sim_corr: Generate partially observed functional data with spatially...

View source: R/sim_corr.R

sim_corrR Documentation

Generate partially observed functional data with spatially correlated case

Description

Partially observed functional data is generated with 51 regular grids from the spatially correlated model

Usage

sim_corr(
  n = 403,
  type = c("partial", "snippet", "dense"),
  out.prop = 0.2,
  out.type = 1,
  dist = "normal",
  noise = 0,
  dist.mat = dist.mat,
  d = 1.4,
  f = 0.2,
  r.par = 200
)

Arguments

n

a number of curves

type

the type of generated data. "partial" means the option for partially observed data, "snippet" is short fragmented data, and "dense" means the fully observed curves.

out.prop

a proportion of outlying curves of total n curves. Only used for dist = "normal".

out.type

a outlier type, 1~3 are supported. Only used for dist = "normal".

dist

a distribution which the data is generated. "normal"(Normal distribution) and "tdist"(t-distribution) are supported. If dist = "tdist", the option of out.prop and out.type are ignored.

noise

a numeric value which is added random gaussian noises. Default is 0(No random noise).

dist.mat

a 403 spatial locations and their distances matrix

d

a parameter for missingness when type is "partial" (See Kraus(2015))

f

a parameter for missingness when type is "partial" (See Kraus(2015))

r.par

a parameter that control the spatial correlation

Value

a list contatining as follows:

Ly

a list of n vectors containing the observed values for each individual.

Lt

a list of n vectors containing the observation time points for each individual corresponding to Ly

out.ind

a vector containing outlier index. 0 is non-outlier and 1 is the outlier.

x.full

a n x 51 dense matrix with n observations per 51 timepoints before making partially observed.

References

Kraus, D. (2015). Components and completion of partially observed functional data. Journal of the Royal Statistical Society: Series B: Statistical Methodology, 777-801.

Examples

set.seed(100)
n <- 100
x.list <- sim_corr(n = n,
                   type = "partial",
                   out.prop = 0.2,
                   dist = "normal",
                   dist.mat = dist.mat[1:n, 1:n])
x <- list2matrix(x.list)
matplot(t(x), type = "l")


statKim/robfpca documentation built on April 15, 2023, 10:12 p.m.