R package to plot the complete pooling, no pooling, and partially pooled estimates for a mixed effects model based on code from TJ Mahr.
You can install lme4plotpartial from github with:
# install.packages("devtools")
devtools::install_github("jrosen48/lme4plotpartial")
Has one function, plot_partial_pooling()
, used as follows:
library(lme4plotpartial)
library(dplyr, warn.conflicts = FALSE)
#> Warning: package 'dplyr' was built under R version 3.4.1
library(ggforce)
#> Warning: package 'ggforce' was built under R version 3.4.1
#> Loading required package: ggplot2
p <- plot_partial_pooling(storms, y_var = wind, x_var = pressure, group = year)
#> Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control
#> $checkConv, : Model failed to converge with max|grad| = 100.388 (tol =
#> 0.002, component 1)
#> Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue
#> - Rescale variables?;Model is nearly unidentifiable: large eigenvalue ratio
#> - Rescale variables?
# Split the facets over several pages
p + facet_wrap_paginate("year", ncol = 3, nrow = 4, page = 1)
p + facet_wrap_paginate("year", ncol = 3, nrow = 4, page = 2)
p + facet_wrap_paginate("year", ncol = 3, nrow = 4, page = 3)
p + facet_wrap_paginate("year", ncol = 3, nrow = 4, page = 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.