项目作者: mkearney

项目描述 :
🎓 Tidy multilevel modeling tools for academics
高级语言: R
项目地址: git://github.com/mkearney/tidymlm.git
创建时间: 2018-06-03T23:42:25Z
项目社区:https://github.com/mkearney/tidymlm

开源协议:Other

下载


" class="reference-link">tidymlm

lifecycle

🎓 Tidy tools for
academics

*** This package is in very early development. Feedback is encouraged!!! ***

Installation

Install the development version from
Github with:

  1. ## install devtools if not already
  2. if (!requireNamespace("devtools", quietly = TRUE)) {
  3. install.packages("devtools")
  4. }
  5. ## install tidymlm from Github
  6. devtools::install_github("mkearney/tidymlm")

Load the package (it, of course, plays nicely with tidyverse).

  1. ## load tidyverse
  2. library(tidyverse)
  3. ## load tidymlm
  4. library(tidymlm)

Multilevel modeling (MLM)

Estimate multilevel (mixed effects) models.

  1. lme4::sleepstudy %>%
  2. tidy_mlm(Reaction ~ Days + (Days | Subject)) %>%
  3. summary()
  4. #> Linear mixed model fit by REML ['lmerMod']
  5. #> Formula: Reaction ~ Days + (Days | Subject)
  6. #> Data: .data
  7. #>
  8. #> REML criterion at convergence: 1743.6
  9. #>
  10. #> Scaled residuals:
  11. #> Min 1Q Median 3Q Max
  12. #> -3.954 -0.463 0.023 0.463 5.179
  13. #>
  14. #> Random effects:
  15. #> Groups Name Variance Std.Dev. Corr
  16. #> Subject (Intercept) 612.1 24.74
  17. #> Days 35.1 5.92 0.07
  18. #> Residual 654.9 25.59
  19. #> Number of obs: 180, groups: Subject, 18
  20. #>
  21. #> Fixed effects:
  22. #> Estimate Std. Error t value
  23. #> (Intercept) 251.41 6.82 36.84
  24. #> Days 10.47 1.55 6.77
  25. #>
  26. #> Correlation of Fixed Effects:
  27. #> (Intr)
  28. #> Days -0.138