Hi all

I am trying to extract fitted splines from GAM packages to use them as an
input in another packages, such as MCMCglmm. Yet, it seems I am missing
something as the predictions don't really match. Here is the code:

gam.1 <- gam(mortality.under.2~ maternal_age_c+ I(maternal_age_c^2)+
               s(birth_year,by=wealth) +
               + wealth + sex +
               residence+ maternal_educ + birth_order,
             ,data=rwanda2,family="binomial")


# MCMC using extracted splines from GAM's
# getting the spline from the GAM's

spline.gam <- predict(gam.1,type="terms")
spline.gam.wealth <- spline.gam[,8:12]
rwanda3 <- cbind(rwanda2,spline.gam.wealth)
colnames(rwanda3)[19:23] <-
c("spline_1","spline_2","spline_3","spline_4","spline_5")


prior.2 <- list(R = list(V = 1, fix = 1), G = list(G1 = list(V = 1,nu = 4)))
glm.MC.3 <- MCMCglmm(mortality.under.2 ~ maternal_age_c +
I(maternal_age_c^2)  +
                       + maternal_educ + birth_order +
                       spline_1 + spline_2 + spline_3 + spline_4 + spline_5
+ wealth +
                       + residence + sex,
                     nitt=20000, thin=10, burnin=10000,
                     random= ~CASEID, prior=prior.2,data=rwanda3,
family='categorical')

Does it make sense? I can provide more detail and a reproducible example,
if needed.

Thanks

	[[alternative HTML version deleted]]

