The future package

Found that future_lapply is better than parLapplyLB in running parallel jobs diverse in speed in Windows. 😊

It took me one afternoon to figure out how to use the future package. I heard about it but no time to learn it before. It's different from parallel because the environment in each worker is not persistent. However, this is a good thing, ensuring a consistent environment. In what I am working on, some jobs are slow and some are fast, but I can't know in advance which jobs are slow. For parLapplyLB with, say, 8 workers, if one worker is working on a slow task, all other workers still need to wait for this worker before getting the next chunk of 8 jobs. I did some tests and it seems that future_lapply, with default scheduling, will assign jobs as long as a worker is free. This is what I think load balancing should do.

The future package is a promising way to do jobs in parallel. I will take more time to learn about it.😉

R notebook

Tried R notebook and I like it.

The next time I introduce R to new users, I may go directly to R notebook and skip console, or only mention it briefly. Many people have no experience in command line interface, for good reasons. They have a hard time learning and understanding the console. Though lines are still sent to the console when running code in R notebooks, users don't really need to know what happens and can focus on the output in an R notebook. R notebook allows a work flow that encourages making analysis reproducible. It also combines planning the analysis and doing the analysis into one single place, without the hassle of iterating between script file and the output file: render the markdown file, check the output, revise and re-render, check, and so on.


An interesting package! I am going teach lavaan this semester. I will try it first and may introduce it to my student. I still think writing and running script is the most efficient work flow. However, a shiny-based interface may be good for learning and testing.


I must confess that I rarely care about BIC in SEM. However, the more I read about it, the more I wonder why "the BIC has received little attention in the structural equation modeling (SEM) literature" (Bollen, Harden, Ray, & Zavisca, 2014, p. 1). BIC, and variants Bollen et al. investigated, can be converted to approximate Bayes factor, which "expresses the odds of observing a given set of data under one model versus an alternative model" (Bollen et al., p. 3). To me, this is more meaningful than CFI, TLI, and even RMSEA and SRMR. Yes, I know people will ask for cutoff values for BIC. But if converted to Bayes factor, a cutoff value for BIC seems to be more meaningful than .90 or .95 for TLI and CFI (Raftery, 1993).
I need to learn more about BIC.

Major Reference:

Bollen, K. A., Harden, J. J., Ray, S., & Zavisca, J. (2014). BIC and alternative Bayesian information criteria in the selection of structural equation models. Structural Equation Modeling: An Multidisciplinary Journal, 21, 1-19. doi:10.1080/10705511.2014.85669

Source windows in RStudio

Link: Using Source Windows (@ RStudio Support)

A good feature! Some users like one single window with panes. Some users like multiple windows. Some users like being able to choose.

I like the interface of GIMP, in which you can switch between single and multiple window modes. I also like the interface of Blender, in which you can work in one window with panes, as in RStudio, or you can work in multiple windows, which can also have mroe than one pane each, just by creating new windows.

I hope RStudio can be more flexible. I don't like the the single window mode when working on a small screen notebook.