library(e1071)
n=500
t=seq(0,1,len=101)
beta=t*sin(2*pi*t)^2 # beta con 2 colinas
x=matrix(NA,ncol=101,nrow=n)
y=numeric(n)
for(i in 1:n){
x[i, ]=rwiener(1,101)*3+rnorm(101,sd=0.1)
y[i]=mean(x[i,]*beta)+ rnorm(1,sd=0.1)
}
x<-fdata(x)
# Correlation
pc.cor(x,y,c(1,4,5.8),ask=TRUE)Run the code above in your browser using DataLab