harvard-ufds / saeczi

Small Area Estimation for Continuous Zero Inflated data
https://harvard-ufds.github.io/saeczi/
Other
4 stars 2 forks source link

workflow for `zi_predict` #8

Closed joshyam-k closed 8 months ago

joshyam-k commented 9 months ago

predictions options:

joshyam-k commented 8 months ago

saving this snippet of code that will help with some of the new prediction work

predict_test <- function(lmmod, glmmod, .data, domain_level) {
  lookup <- setNames(
    lmmod@u,
    model.frame(lmmod)[[domain_level]] |>
      unique() |>
      as.vector()
  )

  .data |>
    mutate(!!domain_level := lookup[.data[[domain_level]]])
}
joshyam-k commented 8 months ago

closing