# linear model
n=100
x=rnorm(n)
y=rnorm(n)
IVCT(y,x,K=5,num_per=20,type = "linear")
# nonlinear model
n=100
p=4
x=matrix(NA,nrow=n,ncol=p)
for(i in 1:p){
x[,i]=runif(n,0,1)
}
y=3*ifelse(x[,1]>0.5,1,0)*x[,2]+3*cos(x[,3])^2*x[,1]+3*(x[,4]^2-1)*x[,1]+rnorm(n)
IVCT(y,x,K=5,num_per=20,type = "nonlinear")
Run the code above in your browser using DataLab