# Get the data
data(ethanol)
# Fit the PS-ANOVA model
ps2d <- SpATS.nogeno(response = "NOx",
spatial = ~PSANOVA(E, C, nseg = c(20, 20), nest.div = c(2, 2)),
data = ethanol,
control = list(maxit = 100, tolerance = 1e-05,
monitoring = 0, update.psi = FALSE))
# Report effective dimensions, if desired
# print(summary(ps2d))
# Compute component surface and their sum on a fine grid
Tr = obtain.spatialtrend(ps2d, grid = c(100, 100))
# Plot surface and contours
image(Tr$row.p, Tr$col.p, Tr$fit, col = terrain.colors(100), xlab = 'C', ylab = 'E')
contour(Tr$row.p, Tr$col.p, Tr$fit, add = TRUE, col = 'blue')
points(ethanol$C, ethanol$E, pch = '+')
Run the code above in your browser using DataLab