I have been using draw()
command, from gratia
package in R, in order to visualize a multivariate GAM, including a smooth factor for geographical data.
The main problem is that the produced graph is slightly unreadable due to the opaqueness of the points. I am going to be using some made up code from Gavin Simpson's gratia Guide.
Here's the script used:
library(gratia)
library(ggplot2)
library(mgcv)
df2 <- data_sim(2, n = 1000, dist = "normal", scale = 1, seed = 2)
m2 <- gam(y ~ s(x, z, k = 40), data = df2, method = "REML")
draw(m2, contour = FALSE)
The graph produced is not exactly what I am looking for, since I said again, my smooth factors demonstrates geographical data. Here, the points appear to have more space between them, and thus, they are more readable.
Using the draw
command again on my GAM, the produced result is this. The basic principles remain the same.