Using mgcv
I have made 5 models, each one using a subset of my data, defined by quantiles. The response/explanitory variables are the same in each case, but the deviance explained by each in each model differs, along with the P values.
Is there a clever way of comparing the contributions of each explanitory variable in each model? The best I've come up with is using portions of the output of summary(GAMx)
to create a monstrous table with the Δ Deviance explained
, Δ AIC
and P value
for each each model, with the rows being the smoothed and parametric variables.
This is pretty ugly and hard to interpret. Are there any functions or packages in R
that would allow a comparison of models - with enough detail to show the contributions of each variable?
Reproducible code:
library(mgcv)
set.seed(0)
n<-200;sig2<-4
x0 <- runif(n, 0, 1);x1 <- runif(n, 0, 1)
x2 <- runif(n, 0, 1)
y<-x0^2+x1*x2 +runif(n,-0.3,0.3)
g1<-gam(y~s(x0,x1,x2))
g2<-gam(y~s(x0,x1,x2))
g3<-gam(y~s(x0,x1,x2))
g4<-gam(y~s(x0,x1,x2))
g5<-gam(y~s(x0,x1,x2))
All 5 models here will be the same, but that shouldn't actually matter.
anova(g1, g2, g3, g4, g5)
? (I just want to see if that's the kind of output you want) $\endgroup$