R package to plot partially pooled estimates for a mixed effects model
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
R
fig
man
.Rbuildignore
.gitignore
DESCRIPTION
LICENSE
NAMESPACE
README.Rmd
README.md
lme4plotpartial.Rproj
plotpartialpooling.Rproj

README.md

lme4plotpartial

R package to plot the complete pooling, no pooling, and partially pooled estimates for a mixed effects model based on code from TJ Mahr.

Installation

You can install lme4plotpartial from github with:

# install.packages("devtools")
devtools::install_github("jrosen48/lme4plotpartial")

Example

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) 

Future Improvements

  • Take additional arguments for covariates and additional random effects.