Skip to content

Instantly share code, notes, and snippets.

@JoFrhwld
Created August 11, 2014 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoFrhwld/e4c71e4c145db9acab47 to your computer and use it in GitHub Desktop.
Save JoFrhwld/e4c71e4c145db9acab47 to your computer and use it in GitHub Desktop.
my bootMer
library(lme4)
mod <- lmer(F1_n ~ plt_vclass * Decade_c * freq_c + (plt_vclass + freq_c| File) + (Decade_c|word),
data = ays_to_test)
boot_fun <- function(mod){
# x is a named vector
x <- fixef(mod)
#out is a longer named vector
out <- c(x,
ay0_freq = x["freq_c"] + x["plt_vclassay0:freq_c"],
ay0_freq_slope = x["Decade_c:freq_c"] + x["plt_vclassay0:Decade_c:freq_c"])
return(out)
}
mod_boot <- bootMer(mod, boot_fun, use.u = T,
type = "semiparametric",
verbose = T,
nsim = 1000)
# Saving the results so I don't need to do it all over again,
# every time I recompile my paper
saveRDS(mod_boot, "mod_boot.rds")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment