Check My Tools to Create and Manipulate Golems

Since two weeks before I published this post, I have started read the book Statistical Rethinking: A Bayesian Course with Examples in R and Stan written by Richard McElreath. Richard is the evolutionary anthropologist at Max Planck Institute. He wrote this textbook for the PhD students who will use the Bayesian statistics in their research projects. Compared to the textbooks written by statisians and data scientistst, Richard’s book explain and demonstrate the statistical methods with examples instead of equations. His intention is to help who are not staticians but used to use statistics realize one fact: we rely on the statistical models as the representations of our answers rather than answer the questions by the raw data or naked truth. Many non-statisticians are used to find and learn what kind of methods or apps to deal with their data, but few are interested to know the models under the mentods and apps they are using. The trouble and danger is that they thought their jobs are done when the program printed the tables and figures but these outputs are from the statistical model is unable to answer their question. This situation is originated from many non-statisticans consider themselves the end-users of statistical models. Like any user of a packaged software, non-statisticans have no time to understand how the tools in their hands designed and conducted by statisticans.
Richard introduced the story of golem to raise the non-statsiticans’ attention to the troubles they had made and will make. A statistical model, like a golem, has the power beyond human to finish the work the human are unable to do, for example, trace the passengers’ track from the trillion of camera. Its power could be misused or out of control if we do not understand what is the root of its action. A user of ststistical method, no matter you are or are not stistician, have to keep the awareness of engineer when you are dealing with your data. Today everyone has many easier ways than a decade ago to keep the awareness of engineer. One advantage is that the learning curve for being an part-time hacker is getting smooth. Increasing R apps are opening many windows for who are want to outlook and modify the statistical models.
Since this post, every post listed in the category Rethinking is one of the summaries and feedbacks to Statistical Rethinking: A Bayesian Course with Examples in R and Stan. At first I have to check my toolkits for create and manipulate the statistical models. They are R core and the packages. Years ago I have used to use the packages in my data processing. Now I show them for who start to use R after read this post.

install.packages(c("rpart","chron","Hmisc","Design","Matrix","stringr","lme4","coda","e1071","zipfR","ape","languageR","multcomp","contrast","shiny","ggplot2", "dplyr"))

Some of the packages are learned from I participated in Cousera Data Science. Now I used to use dplyr to process the raw data, and I am learning how to draw the figures I need in use of ggplot2. When this post is published, I have updated my R to R version 4.0.5 (2021-03-31). Through the codes of Heuristic Andrew, here are my installed packages.

ip <- as.data.frame(installed.packages()[,c(1,3:4)])
rownames(ip) <- NULL
ip <- ip[is.na(ip$Priority),1:2,drop=FALSE]
print(ip, row.names=FALSE)
##                   Package    Version
##                     abind      1.4-5
##                   acepack      1.4.1
##                      afex     0.28-1
##                ANOVApower      0.0.3
##                   anytime      0.3.9
##                       apa      0.3.3
##                       ape      5.4-1
##                       arm     1.11-2
##                   askpass        1.1
##                assertthat      0.2.1
##                 backports      1.2.1
##                 base64enc      0.1-3
##               BayesFactor 0.9.12-4.2
##                bayestestR      0.9.0
##                     bbmle   1.0.23.1
##                 bdsmatrix      1.3-4
##                        BH   1.75.0-0
##                    bibtex    0.4.2.3
##                     bindr      0.1.1
##                  bindrcpp      0.2.2
##                    binman      0.1.2
##                     binom      1.1-1
##                    bitops      1.0-6
##                      blob      1.2.1
##                  blogdown      1.3.1
##                  bookdown       0.21
##                      brew      1.0-6
##            bridgesampling      1.1-2
##                      brio      1.1.1
##               Brobdingnag      1.2-6
##                     broom      0.7.6
##               broom.mixed      0.2.6
##                broomExtra      4.2.1
##                     bslib      0.2.4
##                   BWStest      0.2.2
##                        ca     0.71.1
##                    cachem      1.0.4
##                     callr      3.6.0
##                       car     3.0-10
##                   carData      3.0-4
##                   caTools     1.18.2
##                     cdata      1.1.9
##                cellranger      1.1.0
##                 checkmate      2.0.0
##                  circlize     0.4.12
##                      citr      0.3.2
##                       cli      2.4.0
##                     clipr      0.7.1
##                clisymbols      1.2.0
##                      coda     0.19-4
##                      coin      1.4-1
##                colorspace      2.0-0
##              colourpicker      1.1.0
##                commonmark        1.7
##                compute.es      0.2-5
##                    config      0.3.1
##                   conquer      1.0.2
##                  contfrac     1.1-12
##               correlation      0.6.1
##                  corrplot       0.84
##                      covr      3.5.1
##                   cowplot      1.1.1
##                     cpp11      0.2.7
##                    crayon      1.4.1
##               credentials      1.3.0
##                 crosstalk      1.1.1
##                      crul      1.1.0
##                   cubelyr      1.0.1
##                      curl        4.3
##                   dagitty      0.3-1
##                data.table     1.14.0
##                dataskills       2.11
##                       DBI      1.1.1
##                    dbplyr      2.1.1
##                      desc      1.3.0
##                 DescTools    0.99.41
##                   deSolve       1.28
##                  devtools      2.4.0
##               DiceKriging      1.6.0
##                 dichromat      2.0-0
##                   diffobj      0.3.4
##                    digest     0.6.27
##                   distill        1.2
##                 dotCall64      1.0-1
##                   downlit      0.2.1
##                     dplyr      1.0.5
##                        DT       0.18
##                    dtplyr      1.1.0
##                 dunn.test      1.3.5
##                  dygraphs    1.1.1.6
##                     e1071      1.7-6
##                effectsize    0.4.4-1
##                   effsize      0.8.1
##                   ellipse      0.4.2
##                  ellipsis      0.3.1
##                  elliptic      1.4-0
##                   emmeans    1.5.5-1
##                       emo 0.0.0.9000
##                       EMT        1.1
##               equivalence      0.7.2
##              estimability        1.3
##                  evaluate       0.14
##                     Exact        2.1
##            exactRankTests     0.8-31
##                      expm    0.999-6
##                 extrafont       0.17
##               extrafontdb        1.0
##                        ez      4.4-0
##                     fansi      0.4.2
##                    farver      2.1.0
##                fastGHQuad        1.0
##                   fastmap      1.1.0
##                 fastmatch      1.1-0
##                      faux      1.0.0
##                   fauxpas      0.5.0
##                    fields       11.6
##                  finalfit      1.0.2
##           fivethirtyeight      0.6.1
##             flexdashboard      0.5.2
##                 flextable      0.6.5
##                   forcats      0.5.1
##                   foreach      1.5.1
##                   Formula      1.2-4
##             formula.tools      1.7.1
##                        fs      1.5.0
##                     furrr      0.2.2
##                    future     1.21.0
##             gameofthrones      1.0.2
##                 gapminder      0.3.0
##                    gargle      1.1.0
##                     gdata     2.18.0
##                   gdtools      0.2.3
##                  generics      0.1.0
##                 geosphere     1.5-10
##                      gert      1.3.0
##                   getPass      0.2-2
##                ggalluvial     0.12.3
##                    GGally      2.1.1
##                ggcorrplot      0.1.3
##                 ggeffects      1.0.2
##                   ggExtra        0.9
##                   ggforce      0.3.3
##                       ggm        2.5
##                     ggmap      3.0.0
##                   ggplot2      3.3.3
##             ggplot2movies      0.0.1
##                    ggpubr      0.4.0
##                    ggraph      2.0.5
##                   ggrepel      0.9.1
##                  ggridges      0.5.3
##                     ggsci        2.9
##                  ggsignif      0.6.1
##               ggstatsplot      0.7.2
##                    ggtext      0.1.1
##                  ggthemes      4.2.4
##                        gh      1.2.1
##                     git2r     0.28.0
##                  gitcreds      0.1.1
##                       gld      2.6.2
##                   glmmTMB    1.0.2.1
##             GlobalOptions      0.1.2
##                   globals     0.14.0
##                      glue      1.4.2
##                       gmp      0.6-2
##                       gnm      1.1-1
##               googledrive      1.0.1
##              googlesheets      0.3.0
##             googlesheets4      0.3.0
##               GPArotation  2014.11-1
##                    gplots      3.1.1
##              graphlayouts      0.7.1
##                 gridExtra        2.3
##                  gridtext      0.1.4
##                 groundhog      1.3.2
##              groupedstats      2.0.1
##                       gsl      2.1-6
##                    gtable      0.3.0
##                    gtools      3.8.2
##               harrypotter      2.1.1
##                     haven      2.3.1
##                     headR      0.1.1
##                      here      1.0.1
##                     highr        0.9
##                     Hmisc      4.5-0
##                       hms      1.0.0
##                hrbrthemes      0.8.0
##                  htmldeps      0.1.1
##                 htmlTable      2.1.0
##                 htmltools    0.5.1.1
##               htmlwidgets      1.5.3
##                  httpcode      0.3.0
##                    httpuv      1.5.5
##                      httr      1.4.2
##                  hunspell      3.0.1
##                  hypergeo     1.2-13
##                       ids      1.0.1
##                    igraph      1.2.6
##                     infer      0.5.4
##                       ini      0.3.1
##                    inline     0.3.17
##                   insight     0.13.2
##                  installr     0.22.0
##                    ipmisc      6.0.0
##                      ISLR        1.2
##                   isoband      0.2.4
##                  ISOcodes 2021.02.24
##                 iterators     1.0.13
##               janeaustenr      0.1.5
##                   janitor      2.1.0
##                   jcolors      0.0.4
##                       jmv     1.2.23
##                jmvconnect     1.2.18
##                   jmvcore     1.2.23
##                      jomo      2.7-2
##                      jpeg    0.1-8.1
##                 jquerylib      0.1.3
##                  jsonlite      1.7.2
##                  jspsychr 0.0.0.9000
##                kableExtra      1.3.4
##                     km.ci      0.5-2
##                    KMsurv      0.1-5
##                     knitr       1.32
##                    koRpus     0.13-5
##            koRpus.lang.en      0.1-4
##                  kSamples      1.2-9
##                  labeling      0.4.2
##                 languageR      1.5.0
##             LaplacesDemon     16.1.4
##                     later    1.1.0.1
##              latticeExtra     0.6-29
##                    lavaan      0.6-8
##                  lazyeval      0.2.2
##                   LCFdata        2.0
##                   leaflet    2.0.4.1
##         leaflet.providers      1.9.0
##                   libcoin      1.0-8
##                 lifecycle      1.0.0
##                   listenv      0.8.0
##                      lme4     1.1-26
##  LMERConvenienceFunctions        3.0
##                  lmerTest      3.1-3
##                      lmom        2.8
##                    lmtest     0.9-38
##                 logspline     2.1.16
##                       loo      2.4.1
##                   lsmeans     2.30-0
##                 lubridate     1.7.10
##                      lutz      0.3.1
##                    magick      2.7.1
##                  magrittr      2.0.1
##          manipulateWidget     0.10.1
##                   mapproj      1.2.7
##                      maps      3.3.0
##                  maptools      1.1-1
##                  markdown        1.1
##                  mathjaxr      1.4-0
##                matrixcalc      1.0-3
##              MatrixModels      0.5-0
##               matrixStats     0.58.0
##                   maxstat     0.7-25
##                     MBESS      4.8.0
##                      mc2d     0.1-19
##                   memoise      2.0.0
##                     MEMSS      0.9-3
##                   metaBMA      0.6.7
##                   metafor      2.4-0
##                  metaplus     0.7-11
##                        mi        1.0
##                      mice     3.13.0
##                      mime       0.10
##                    miniUI    0.1.1.1
##                     minqa      1.2.4
##                     mitml      0.4-1
##                    mnormt      2.0.2
##                 modeldata      0.1.0
##                    modelr      0.1.8
##                modeltools     0.2-23
##                moderndive      0.5.1
##                   moments       0.14
##                      MOTE      1.0.2
##                  multcomp     1.4-16
##              multcompView      0.1-8
##                     MuMIn    1.43.17
##                   munsell      0.5.0
##                mvnormtest      0.1-9
##                   mvtnorm      1.1-1
##                   network     1.16.1
##                     ngram      3.1.0
##                     nlmeU     0.70-3
##                    nloptr    1.2.2.2
##                       NLP      0.2-1
##                   nortest      1.0-4
##                  numDeriv 2016.8-1.1
##              nycflights13      1.0.2
##                   officer     0.3.18
##                 oompaBase      3.2.9
##                    OpenMx     2.19.1
##                   openssl      1.4.3
##                  openxlsx      4.2.3
##            operator.tools      1.6.3
##                   ordinal 2019.12-10
##                      osfr      0.2.8
##                   packrat      0.6.0
##                PairedData      1.1.1
##       pairwiseComparisons      3.1.3
##                 paletteer      1.3.0
##                      palr      0.2.0
##                      pals        1.7
##                       pan        1.6
##                    pander      0.6.3
##                    papaja 0.1.0.9942
##                parallelly     1.24.0
##                parameters     0.13.0
##                 patchwork      1.1.1
##                   pbapply      1.4-3
##                  pbivnorm      0.6.0
##                  pbkrtest      0.5.1
##               performance      0.7.1
##                    pillar      1.6.0
##                  pkgbuild      1.2.0
##                 pkgconfig      2.0.3
##                   pkgload      1.2.1
##                       PKI      0.1-8
##                     plogr      0.2.0
##                    plotly      4.9.3
##                   plotrix      3.8-1
##                   plumber      1.1.0
##                      plyr      1.8.6
##                     PMCMR        4.3
##                 PMCMRplus      1.9.0
##                       png      0.1-7
##                  polyclip     1.10-0
##                   polynom      1.4-0
##                     ppcor        1.1
##                    praise      1.0.0
##                    prereg      0.5.0
##               prettyunits      1.1.1
##                 prismatic      1.0.0
##                      pROC   1.17.0.1
##                  processx      3.5.1
##                  progress      1.2.2
##                  promises    1.2.0.1
##                     proto      1.0.0
##                     proxy     0.4-25
##                    proxyC      0.1.5
##                        ps      1.6.0
##                     psych      2.1.3
##                     purrr      0.3.4
##                       pwr      1.3-0
##                  quanteda      3.0.0
##                 QuantPsyc        1.5
##                  quantreg       5.85
##                    qvcalc      1.0.2
##                   R.cache     0.14.0
##               R.methodsS3      1.8.1
##                      R.oo     1.24.0
##                   R.utils     2.10.1
##                        R6      2.5.0
##                randomizeR      2.0.0
##                  rappdirs      0.3.3
##                    raster      3.4-5
##                 rcmdcheck      1.3.3
##              RColorBrewer      1.1-2
##                rcompanion      2.4.0
##                      Rcpp      1.0.6
##             RcppArmadillo 0.10.4.0.0
##                 RcppEigen  0.3.3.9.1
##              RcppParallel      5.1.1
##                     RCurl   1.98-1.3
##                  readbulk      1.1.3
##                     readr      1.4.0
##                    readxl      1.3.1
##                RefManageR      1.3.0
##                    relimp      1.0-5
##                   rematch      1.0.1
##                  rematch2      2.1.2
##                   remotes      2.3.0
##                      repr      1.1.3
##                    reprex      2.0.0
##                   reshape      0.8.8
##                  reshape2      1.4.4
##                reticulate       1.18
##                  revealjs        0.9
##                       rex      1.2.0
##                       rgl   0.105.22
##               RgoogleMaps    1.4.5.3
##                       rio     0.5.26
##                     rJava     0.9-13
##                     rjson     0.2.20
##                   RJSONIO    1.3-1.4
##                     rlang     0.4.10
##                       rle      0.9.2
##                    RLRsim      3.1-6
##                 rmarkdown        2.7
##                  rmdfiltr      0.1.3
##                     Rmpfr      0.8-4
##                      ROCR     1.0-11
##                 rootSolve    1.8.2.1
##                    rorcid      0.7.0
##                  roxygen2      7.1.1
##                rpart.plot      3.0.9
##                       rpf      1.0.5
##                 rprojroot      2.0.2
##               rqdatatable      1.2.9
##                    rquery      1.4.6
##                   rsample      0.0.9
##                 rsconnect     0.8.17
##                 RSelenium      1.7.7
##                     rstan     2.21.2
##                rstantools      2.1.1
##                   rstatix      0.7.0
##                rstudioapi       0.13
##                   rticles       0.19
##                  Rttf2pt1      1.3.8
##                 rversions      2.0.2
##                     rvest      1.0.0
##                  sandwich      3.0-0
##                      sass      0.3.1
##                    scales      1.1.1
##                   scholar      0.2.0
##                     scico      1.2.0
##              scienceverse 0.0.0.9004
##                   selectr      0.4-2
##                       sem     3.1-11
##                  semTools      0.5-4
##                    semver      0.2.0
##                     servr       0.22
##               sessioninfo      1.1.1
##                     shape      1.4.5
##                     shiny      1.6.0
##            shinydashboard      0.7.1
##                   shinyjs      2.0.0
##               shinythemes      1.2.0
##                      sigr      1.1.3
##                      simr      1.0.5
##                sjlabelled      1.1.7
##                    sjmisc      2.8.6
##                    sjPlot      2.8.7
##                   sjstats     0.18.1
##                     skimr      2.1.3
##                      slam     0.1-48
##                    slider      0.2.1
##                        sm    2.2-5.6
##                       sna        2.6
##                 snakecase     0.11.0
##                 SnowballC      0.7.0
##                    sodium        1.1
##               sourcetools      0.1.7
##                        sp      1.4-5
##                      spam      2.6-0
##                   SparseM       1.81
##               StanHeaders   2.21.0-7
##                   statmod     1.4.35
##            statnet.common      4.4.1
##          statsExpressions      1.0.1
##                 stopwords        2.2
##                   stringi      1.5.3
##                   stringr      1.4.0
##                subprocess      0.8.3
##                Superpower      0.1.1
##                 SuppDists    1.1-9.5
##                 survminer      0.4.9
##                  survMisc      0.5.5
##                   svglite      2.0.0
##                   swagger     3.33.1
##                  sylcount      0.2-2
##                     sylly      0.1-6
##                  sylly.en      0.1-3
##                       sys        3.4
##               systemfonts      1.0.1
##                    tables      0.9.6
##                       tau     0.0-23
##                tensorflow      2.4.0
##                  testthat      3.0.2
##                   textcat      1.0-7
##                    tfruns      1.5.0
##                   TH.data     1.0-10
##                    tibble      3.1.0
##                    tidyBF      0.5.0
##                 tidygraph      1.2.0
##                     tidyr      1.1.3
##                   tidyRSS      2.0.3
##                tidyselect      1.1.0
##                  tidytext      0.3.1
##                 tidyverse      1.3.1
##                timesavers      0.1.2
##                   tinytex       0.31
##                        tm      0.7-8
##                       TMB     1.7.20
##                   tmvnsim      1.0-2
##                tokenizers      0.2.1
##               topicmodels     0.2-12
##                    TOSTER      0.3.4
##                translateR        1.0
##                 triebeard      0.3.0
##                 truncnorm      1.0-8
##                    tweenr      1.0.2
##                    ucminf      1.1-4
##               ukbabynames      0.1.1
##                   Unicode   13.0.0-2
##                  urltools      1.7.3
##                   usethis      2.0.1
##                      utf8      1.2.1
##                      uuid      0.1-4
##                        V8      3.4.0
##                       vcd      1.4-8
##                  vcdExtra      0.7-5
##                     vctrs      0.3.7
##                   viridis      0.6.0
##               viridisLite      0.4.0
##                     waldo      0.2.5
##                      warp      0.2.0
##                     wdman      0.2.5
##                   webshot      0.5.2
##                  webutils        1.1
##               wesanderson      0.3.6
##                   whisker        0.4
##                     widyr      0.1.3
##                     withr      2.4.2
##                 wordcloud        2.6
##            wordcountaddin 0.3.0.9000
##                 workflowr      1.6.2
##                     wrapr      2.0.7
##                      WRS2      1.1-1
##                   WVPlots      1.3.2
##                   WWGbook      1.0.1
##                  xaringan       0.20
##                      xfun       0.22
##                 XLConnect      1.0.3
##             XLConnectJars     0.2-15
##                      xlsx      0.6.5
##                  xlsxjars      0.6.1
##                       XML   3.99-0.6
##                      xml2      1.3.2
##                     xopen      1.0.0
##                    xtable      1.8-4
##                       xts     0.12.1
##                      yaml      2.2.1
##                   zeallot      0.1.0
##                       zip      2.1.1
##                       zoo      1.8-9
print(paste0("There are ",dim(ip)[1], " packages installed in my laptop."))
## [1] "There are 541 packages installed in my laptop."

Richard’s book inspired me help people control their golems/ststistical models in the process of coding. In his book, literature and codes are separated. Readers who are not familiar with coding skill might hardly follow his literature. Literatural coding might be the best way to impliment the Rethinking. I am going to accumulating the codes of Bayesian statistics and thake notes of his and others literatures in the coming posts.

Sau-Chin Chen
Sau-Chin Chen
Associate Professor of Cognitive Psychology