# NOT RUN {
# GAM formula
form1 <- makeGAM(c('x1', 'x2'), response = 'y', invariant = '0 + Intercept')
# GAM with additional linear terms
form2 <- makeGAM(c('x1', 'x2'), response = 'y', invariant = '0 + Intercept',
linear = c('x1', 'x2', 'x3'))
# }
# NOT RUN {
library(INLA)
data(Epil)
observed <- Epil[1:30, 'y']
Epil <- rbind(Epil, Epil[1:30, ])
Epil[1:30, 'y'] <- NA
## make centered covariates
formula = y ~ Trt + Age + V4 +
f(Ind, model="iid") + f(rand,model="iid")
formula <- makeGAM('Age', invariant = '', linear = c('Age', 'Trt', 'V4'), returnstring = FALSE)
result = inla(formula, family="poisson", data = Epil,
control.predictor = list(compute = TRUE, link = 1))
ggplot_inla_residuals(result, observed, binwidth = 0.2)
autoplot(result)
# }
Run the code above in your browser using DataLab