# NOT RUN {
## generate swiss roll with auxiliary dimensions
## it follows reference example from LSIR paper.
n = 123
theta = runif(n)
h = runif(n)
t = (1+2*theta)*(3*pi/2)
X = array(0,c(n,10))
X[,1] = t*cos(t)
X[,2] = 21*h
X[,3] = t*sin(t)
X[,4:10] = matrix(runif(7*n), nrow=n)
## corresponding response vector
y = sin(5*pi*theta)+(runif(n)*sqrt(0.1))
## try with different regularization methods
## use default number of slices
out1 = do.rsir(X, y, regmethod="Ridge")
out2 = do.rsir(X, y, regmethod="Tikhonov")
out3 = do.rsir(X, y, regmethod="PCA")
out4 = do.rsir(X, y, regmethod="PCARidge")
out5 = do.rsir(X, y, regmethod="PCATikhonov")
outsir = do.sir(X, y)
## visualize
par(mfrow=c(2,3))
plot(out1$Y[,1], out1$Y[,2], main="RSIR::Ridge")
plot(out2$Y[,1], out2$Y[,2], main="RSIR::Tikhonov")
plot(out3$Y[,1], out3$Y[,2], main="RSIR::PCA")
plot(out4$Y[,1], out4$Y[,2], main="RSIR::PCA+Ridge")
plot(out5$Y[,1], out5$Y[,2], main="RSIR::PCA+Tikhonov")
plot(outsir$Y[,1], outsir$Y[,2], main="standard SIR")
# }
Run the code above in your browser using DataLab