mixstock包中calc.RL.0函数找不到的问题及替代方案咨询
混合种群分析中mixstock包calc.RL.0函数调用问题
问题背景
在使用mixstock包及内置的lahanas98raw数据集进行混合种群分析时,执行Raftery and Lewis收敛诊断(对应教程第14页内容),出现找不到calc.RL.0函数的错误。
安装与运行情况
- 初始安装mixstock包时收到警告:
Warning in install.packages : package ‘mixstock’ is not available for this version of R. - 尝试安装教程推荐的R 2.14.1版本,但该版本与RStudio不兼容,转而从CRAN归档下载mixstock 0.9.5.1版本手动安装。
- 手动安装后大部分代码可正常运行,但调用
calc.RL.0(mydata)时出现错误:Error in calc.RL.0(mydata) : could not find function "calc.RL.0" - 包窗口中可见该函数,且同包其他calc系列函数(如
calc.GR、calc.mult.GR、calc.mult.RL)均可正常运行,已确认依赖的coda包已安装并加载。
相关代码
## Calculate confidence intervals - i.e., bootstrapping - and plot them mydata.umlboot = genboot(mydata,"uml") confint(mydata.umlboot) plot(mydata.umlboot, ylim=c(0,1)) ## Carry out Markov Chain Monte Carlo (MCMC) estimations and plot them mydata.mcmc = tmcmc(mydata) mydata.mcmc confint(mydata.mcmc) plot(mydata.mcmc, ylim=c(0,1)) ## Check that the Markov chains have converged = run Raftery and Lewis diagnostics library(mixstock) library(coda) calc.RL.0(mydata) # Error in calc.RL.0(mydata) : could not find function "calc.RL.0"
疑问
- 该问题是否与mixstock的安装方式有关?
- 是否有其他方法可执行Raftery and Lewis诊断并获取所需输出(最后一条链的诊断结果、各建议链长度的历史记录)?
内容的提问来源于stack exchange,提问作者nrwestlake
相关产品推荐
相关产品推荐

