I'm using the mgcv
package to create GAMs in R. Right now I am attempting to model the interaction between my numerical variable Depth and various categorical variables. I have converted all of the categorical variables from characters to factors and generally the GAM function seems to be working well to model the interactions, but it is not doing any calculations or modeling for the first term of any of my categorical variables as far as I can tell.
This is my relevant code:
test1 <- gam(Depth ~ Bottom_typef + Tidal_stagef, data = data,
method = "REML")
plot(test1, all.terms = TRUE, page = 1)
summary(test1)
This then outputs this graph and summary:
Family: gaussian
Link function: identity
Formula:
Depth \~ Bottom_typef + Tidal_stagef
Parametric coefficients:
Estimate Std. Error t value Pr(\>|t|)
(Intercept) 33.0838 0.3238 102.181 \< 2e-16 \*\*\*
Bottom_typefSand -20.4855 0.5053 -40.538 \< 2e-16 \*\*\*
Bottom_typefSeagrass -26.7308 0.3243 -82.435 \< 2e-16 \*\*\*
Tidal_stagefOutgoing -0.4571 0.1599 -2.858 0.00429 \*\*
The Bottom_typef factor should have 3 levels, Artificial Reef, Sand, and Seagrass, and the Tidal_stagef factor has two, Incoming and Outgoing. When plotted, the first two categories respectively, Artificial Reef and Incoming, don't appear to actually be plotted, just appear as a line at 0. In the summary, they aren't even listed under the Intercepts. I have other categorical variables in my data set and the same thing occurs for all of them, the first category is not plotted or calculated in the summary.
Any input on how to fix this issue or on what may be causing the issue would be greatly appreciated. I apologize if I am using improper terminology or leaving out any important info, let me know if there's any other info needed to solve the problem.