When the expression contains non-library functions/objects, and parallel processing is enabled, those must be named in the .globals parameter (hopefully we'll be able to detect those automatically in the future). Note that recompute_statistics() currently does not use parallel processing, so .globals don't need to be set.

generated_quantities(..., .globals = list())

Arguments

...

named expressions representing the quantitites

.globals

A list of names of objects that are defined in the global environment and need to present for the gen. quants. to evaluate. It is added to the globals argument to future::future(), to make those objects available on all workers.