I have an indicator (intervention coverage in %) where data stop in 2015 and I would like to extrapolate/project data till 2018.
I have used the following code that basically predicts data using glm with time as covariate in the logit space.
My colleagues think a GAM model would be better but I don't see what would be the added value. Could you explain what would be the difference and which model would be best to use?
df_na <- df3 %>%
filter(!is.na(y))
func <- function(data,country){
data = subset(data,iso3==country)
data[match(2010:2015,data$year),]$y
}
proj <- function(y, year=2010:2015, target=2018){
period <- year[1]:target
yhat <- predict(glm(y ~ year, family=quasibinomial), newdata=data.frame(year=period),type="response")
return(data.frame(year=period, y=yhat))
}
res <- lapply(unique(df_na$iso3),function(i){
data.frame(country=i,proj(func(df_na,country=i)))
})
res <- do.call(rbind,res)