t <- seq(0, 1, length.out = 100)
# Basic simulation with Fourier basis
fd <- simFunData(n = 20, argvals = t, M = 5,
eFun.type = "Fourier", eVal.type = "linear")
plot(fd, main = "Simulated Functional Data (Fourier, Linear)")
# Smoother curves with exponential decay
fd_smooth <- simFunData(n = 20, argvals = t, M = 10,
eFun.type = "Fourier", eVal.type = "exponential")
plot(fd_smooth, main = "Smooth Simulated Data (Exponential Decay)")
# Wiener process simulation
fd_wiener <- simFunData(n = 20, argvals = t, M = 10,
eFun.type = "Wiener", eVal.type = "wiener", seed = 42)
plot(fd_wiener, main = "Wiener Process Simulation")
# With mean function
mean_fn <- function(t) sin(2 * pi * t)
fd_mean <- simFunData(n = 20, argvals = t, M = 5, mean = mean_fn, seed = 42)
plot(fd_mean, main = "Simulated Data with Sinusoidal Mean")
Run the code above in your browser using DataLab