为什么添加第二个解释变量后拟合会变差?
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")