Looking at the predictors to water quality: using GAM
Continuing my analysis on water quality, on this post I try to look at the predictors that control water quality. I am still using GAM with mgcv package. We can use (x,y) coordinate as one of the predictor, as tensor function using "te()" command. Character-type column can also be used as the predictor without "s()" command. In the following code, I am putting the:
EC (electro-conductivity) and concentrations of CO3, HCO3, CO2, Cl, SO4, NO2, NO3, Fe (in mg/L) as predictant
Spatial distribution "te(x,y)" + geology "(data$aq) column" and + elevation "s(elevation)" as predictors
One of the result from "plot(gam.., pages=1)" command will look something like the above image. I will elaborate more on the results and the workaround later on. The following is the sample code.