Why does the fit get worse after adding the second explanatory variable?
require("VGAM")
df = data.frame(x = c(1,2,3,4,5,6,7,8,9,10), y = c(1,4,8,15,25,36,48,65,80,105), z =        c(0,0,0,1,100,400,900,1600,1800,200)  )
vgt1 = vgam(y~s(x, df=2), data=df,family=gaussianff, trace=TRUE)
vgt2 = vgam(y~cbind(s(x, df=2),s(z, df=2)), data=df,family=gaussianff, trace=TRUE)
plot(df$x, df$y, col="black")
lines(df$x, vgt1@predictors, col="red")
lines(df$x, vgt2@predictors, col="blue")
 
                        
When you add a variable you use
+not cbind.vgamparses the formula usingterms.formulato look forspecials = 's', i.e. terms that are wrapped inssignifying a spline.Therefore
will give you what you want (and this has a lower deviance than
vgt1).When you fit
terms.formuladoesn't find anyspecialsthat start withs, ascbindis the function that identifies the term in the formula. Thereforeis the equivalent of
which in term is the equivalent of
i.e. no spline terms are fitted.