sim_sfda_data: generates data from a family of curves

Description Usage Arguments Value Examples

Description

generates a functional data set by evaluating curves and adding Gaussian noise.

Usage

1
2
sim_sfda_data(locs, coef, basis.fns, sigma0, m = NULL, pts = NULL,
  DIST = runif, ...)

Arguments

locs

N by 2 matrix of spatial locations

coef

matrix or data frame containing the coefficients of the basis functions. The number of columns is equal to the number of basis functions

basis.fns

basis functions given by the output of create_basis

sigma0

standard deviation of the noise term.

m

number of observations per curve

pts

vector of values where the curves will be evaluated

DIST

distribution function used to generate observatin locations for each curve. Default is runif().

...

additional parameter passed to dist function

Value

ID integer identifying a single curve

locs spatial location of each curve

Time argument values where curves are evaluated

X response variable

Examples

1
2
3
4
5
curves <- sim_sfda_curves(nBasis = 2, cov.model = c("gaussian", "exponential"), cov.pars = rbind(c(1, 0.5), c(1, .3)), type="Cos", basis.pars = 2, locs = expand.grid(1:5/5, 1:10/10))
plot_curves(curves$coef, curves$basis.fns, ylim=c(-3,3))

sim.data <- sim_sfda_data(curves$locs, curves$coef, curves$basis.fns, sigma0=0.4, m = 10)
## plot_data(sim.data)

dan410/sfdasim documentation built on May 14, 2019, 3:34 p.m.