Skip to contents

英文原页:cmsy_jags_versions()

说明

CMSY++通过rjags包在JAGS中运行MCMC,而JAGS安装程序必须与操作系统和R版本匹配:在Windows和macOS上,每个JAGS二进制版本都是针对一定范围的R版本编译的,并且CRAN上的rjags(4-17)只能与JAGS 4配合使用。本函数针对每个系统列出适用的R版本、JAGS安装程序、所需的rjags版本、是否为默认选择以及依据(JAGS下载页面的README,以及本包GitHub Actions工作流在Windows、macOS和Linux上的运行结果),并标出本机对应的那一行。

English

CMSY++ runs its MCMC in JAGS through the rjags package, and the JAGS installer must match the operating system and the R version: on Windows and macOS each JAGS binary is built for a range of R versions, and rjags from CRAN (4-17) works only with JAGS 4. This function lists, for each system, the R versions, the JAGS installer, the rjags version it needs, whether it is the default, and the evidence (the README of the JAGS downloads, and the runs on Windows, macOS and Linux of the package’s GitHub Actions workflow), and marks the row for this computer.

用法

cmsy_jags_versions(
  os = "all",
  r_version = getRversion(),
  silent = fao_setting("silent")
)

参数

os
“all”(默认),或单个系统:“auto”(本机)、“windows”、“macos”或”linux”。
English “all” (default), or one system: “auto” (this computer), “windows”, “macos” or “linux”.
r_version
在this_computer列中据以标记本机的R版本。默认为当前运行的R版本。
English The R version marked as this_computer. Default is the running R.
silent
逻辑值。为FALSE(默认)时,输出与本机匹配的版本。
English A logical value. If FALSE (default), the match for this computer is printed.

返回值

一个数据框,每行对应一个系统、JAGS版本和R版本范围。

English

A data frame with one row per system, JAGS version and range of R versions.

详细说明

简要对照(默认使用JAGS 4):

系统 R版本 JAGS安装程序
Windows 4.5或4.6 JAGS-4.3.2.exe
Windows 4.2至4.4 JAGS-4.3.1.exe
macOS 4.3及以后 JAGS-4.3.2.pkg
macOS 4.2 JAGS-4.3.1.pkg
Linux 任意 包管理器(例如apt-get install jags)或JAGS-4.3.2.tar.gz

以上全部可与CRAN上的rjags 4配合使用(4-17;macOS上R 4.2的CRAN二进制包为4-15)。JAGS 5.0.0(cmsy_download_jags()中的version = "latest"和cmsy_setup()中的jags = "latest")需要rjags 5-3,该版本尚未发布到CRAN,需从SourceForge下载。

cmsy_download_jags()会自动下载匹配的安装程序,cmsy_setup()则会下载并打开它。

English

In short (JAGS 4, the default):

System R version JAGS installer
Windows 4.5 or 4.6 JAGS-4.3.2.exe
Windows 4.2 to 4.4 JAGS-4.3.1.exe
macOS 4.3 or later JAGS-4.3.2.pkg
macOS 4.2 JAGS-4.3.1.pkg
Linux any package manager (e.g. apt-get install jags) or JAGS-4.3.2.tar.gz

All of them work with rjags 4 from CRAN (4-17; the CRAN binary for R 4.2 on macOS is 4-15). JAGS 5.0.0 (version = "latest" in cmsy_download_jags() and jags = "latest" in cmsy_setup()) needs rjags 5-3, which is not yet on CRAN and is downloaded from SourceForge.

cmsy_download_jags() downloads the matching installer automatically, and cmsy_setup() downloads and opens it.

参考文献

Plummer, M. (2003). JAGS: A program for analysis of Bayesian graphical models using Gibbs sampling. Proceedings of DSC 2003, Vienna. https://mcmc-jags.sourceforge.io/

示例

# The whole table, with the row for this computer marked
cmsy_jags_versions()

# One system, e.g. to tell a colleague on Windows with R 4.4 which installer to use
cmsy_jags_versions("windows", r_version = "4.4.1")