I'm trying to test various functional data analysis approaches.
Ideally, i'd like to test the panel of approaches i have on simulated functional data. I've tried to generate simulated FD using an approach based on a summing Gaussian noises (code below), but the resulting curves look much too rugged compared to the real thing.
I was wondering whether somebody had a pointer to functions/ideas to generate
more realistic looking simulated functional data. In particular, these should be smooth. I'm completely new to this field so any advice is welcomed.
library("MASS")
library("caTools")
VCM<-function(cont,theta=0.99){
Sigma<-matrix(rep(0,length(cont)^2),nrow=length(cont))
for(i in 1:nrow(Sigma)){
for (j in 1:ncol(Sigma)) Sigma[i,j]<-theta^(abs(cont[i]-cont[j]))
}
return(Sigma)
}
t1<-1:120
CVC<-runmean(cumsum(rnorm(length(t1))),k=10)
VMC<-VCM(cont=t1,theta=0.99)
sig<-runif(ncol(VMC))
VMC<-diag(sig)%*%VMC%*%diag(sig)
DTA<-mvrnorm(100,rep(0,ncol(VMC)),VMC)
DTA<-sweep(DTA,2,CVC)
DTA<-apply(DTA,2,runmean,k=5)
matplot(t(DTA),type="l",col=1,lty=1)
Best Answer
Take a look at how to simulate realizations of a Gaussian Process (GP). The smoothness of the realizations depend on the analytical properties of the covariance function of the GP. This online book has a lot of information: http://uncertainty.stat.cmu.edu/
This video gives a nice introduction to GP's: http://videolectures.net/gpip06_mackay_gpb/
P.S. Regarding your comment, this code may give you a start.