Last active
February 23, 2016 14:26
-
-
Save Rekyt/d7d504dffbd7d05c443a to your computer and use it in GitHub Desktop.
R squared for list of Mixed models
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Compute R squared from a list of computed and selected models | |
| # Packages --------------------------------------------------------------------------------------- | |
| library(MuMIn) | |
| # Fit general model ------------------------------------------------------------------------------ | |
| global_mod = lm(mpg ~ ., data = mtcars) | |
| # Model selection -------------------------------------------------------------------------------- | |
| dd = dredge(global_mod) # Summary table of all models | |
| all_models = get.models(dd, subset = TRUE) | |
| # R Squared -------------------------------------------------------------------------------------- | |
| rsq = do.call(rbind, lapply(all_models, r.squaredGLMM)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment