# NOT RUN {
n=50; r=0.6; Ndisc=1000; t=1/Ndisc
X=matrix(rep(0,Ndisc*n),nrow=n); Y=matrix(rep(0,Ndisc*n),nrow=n)
for(i in 1:n){
x = rnorm(Ndisc, mean=0, sd= 1)
se = sqrt(1 - r^2) #standard deviation of error
e = rnorm(Ndisc, mean=0, sd=se)
y = r*x + e
X[i,] <- cumsum(x*sqrt(t))
Y[i,] <- cumsum(y*sqrt(t))
}
USPFunctional(X,Y,2,1,999)
# }
Run the code above in your browser using DataLab