### 1D functional predictor example ###
data(gasoline)
# input a single value of each tuning parameters
gas.wnet1 <- wnet(gasoline$octane, xfuncs = gasoline$NIR[,1:256],
min.scale = 0, alpha = 1)
# input vectors of candidate tuning parameter values
gas.wnet2 <- wnet(gasoline$octane, xfuncs = gasoline$NIR[,1:256],
min.scale = 0:3, alpha = c(0.9, 1))
### 2D functional predictor example ###
n = 200; d = 64
# Create true coefficient function
ftrue = matrix(0,d,d)
ftrue[40:46,34:38] = 1
# Generate random functional predictors, and scalar responses
ii = array(rnorm(n*d^2), dim=c(n,d,d))
iimat = ii; dim(iimat) = c(n,d^2)
yy = iimat %*% as.vector(ftrue) + rnorm(n, sd=.3)
mm.wnet <- wnet(yy, xfuncs = ii, min.scale = 4, alpha = 1)
image(ftrue)
contour(mm.wnet$fhat, add=TRUE)Run the code above in your browser using DataLab