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