3
$\begingroup$

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)
$\endgroup$
1
  • 1
    $\begingroup$ GAM is used to model the logodds as a nonlinear function of year. $\endgroup$
    – dynamic89
    Commented Jul 7, 2020 at 9:48

1 Answer 1

0
$\begingroup$

In your logistic model with year, time is assumed to act linearly on the logodds. With an additive model estimated with gam, a smooth action replaces the linear action, represented with a spline function. That gives a nice test on the assumption of linearity.

But, you want to use the model for extrapolation? A spline model will not help much with that ... you would first have to extrapolate the spline, how? On the other hand, if the gam model shows that linearity does not hold, using the linear model for extrapolation would be foolhardy. So that's your answer: The gam model mostly is a useful test (informal) on your first model.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.