在"qbeta"中可能未达到完全精度 [英] full precision may not have been achieved in 'qbeta'

查看:133
本文介绍了在"qbeta"中可能未达到完全精度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Windows 7 Ultimate(带8.00GB内存的Intel Core i5-2400 3GHz处理器)的PC上运行R版本2.14.0.让我知道是否需要其他规格.

I am running R version 2.14.0 on a PC which uses Windows 7 Ultimate (Intel Core i5-2400 3GHz processor with 8.00GB ram). Let me know if other specs needed.

我正在尝试模拟相关的beta分布式数据.我使用的方法是对本文内容的扩展:

I am trying to simulate correlated beta distributed data. The method I am using is an extension of what is written in this paper:

http://onlinelibrary.wiley.com/doi/10.1002/asmb. 901/pdf

  1. 基本上,我首先模拟多元正常数据(使用MASS的mvrnorm()函数).
  2. 然后,我使用pnorm()将概率转换应用于这些数据,以使我的新数据向量保持(0,1)的状态.并且仍然根据前面的陈述进行关联.
  3. 然后给定这些经过概率转换的数据,我将qbeta()函数应用于某些shape1和shape2参数,以获取具有某些均值和离散特性的相关beta数据.
  1. Basically, I start by simulating multivariate normal data (using mvrnorm() function from MASS).
  2. Then I use pnorm() to apply the probit transform to these data such that my new data vector(s) live on (0,1). And are still correlated according to the previous statement.
  3. Then given these probit transformed data I apply the qbeta() function with certain shape1 and shape2 parameters, to get back correlated beta data with certain mean and dispersion properties.

我知道还存在其他用于生成相关beta数据的方法.我对为什么qbeta()导致某些种子"无法使用此方法感兴趣.以下是我收到的错误消息.

I know other methods for generating correlated beta data exist. I am interested in why qbeta() causes this method to fail for certain "seeds". Below is the error message I get.

Warning message:
In qbeta(probit_y0, shape1 = a0, shape2 = b0) :
  full precision may not have been achieved in 'qbeta'

这是什么意思?如何避免呢?当它确实在较大的仿真环境中发生时,什么是最好的方法来确保此问题不会终止整个源代码(使用source())仿真代码?

What does this mean? How can it be avoided? When it does occur within the context of a larger simulation what is the best way to ensure that this problem does not terminate the entire sourced (using source()) simulation code?

我为1:1000的整数种子运行了以下代码. Seed = 899是唯一给我带来麻烦的值.尽管如果这里有问题,那么对于其他种子也不可避免地也会有问题.

I ran the following code for integer seeds from 1:1000. Seed=899 was the only value which gave me problems. Though if its problematic here, it inevitably will be problematic for other seeds too.

library(MASS)
set.seed(899)
n0 <- 25  
n1 <- 25    
a0 <- 0.25    
b0 <- 4.75    
a1 <- 0.25    
b1 <- 4.75    
varcov_mat <- matrix(rep(0.25,n0*n0),ncol=n0)
diag(varcov_mat) <- 1
y0 <- mvrnorm(1,mu=rep(0,n0),Sigma=varcov_mat)
y1 <- mvrnorm(1,mu=rep(0,n1),Sigma=varcov_mat)
probit_y0 <- pnorm(y0)
probit_y1 <- pnorm(y1)
beta_y0 <- qbeta(probit_y0, shape1=a0, shape2=b0)
beta_y1 <- qbeta(probit_y1, shape1=a1, shape2=b1)

上面的代码是一个较大的仿真项目的一部分.但是,qbeta()警告消息现在让我头疼.

The above code is a fragment of a piece of a larger simulation project. But the qbeta() warning message is what is giving me a headache now.

该小组可以提供的任何帮助将不胜感激.

Any help the group could provide would be greatly appreciated.

欢呼 克里斯

推荐答案

出现此错误的原因是,用于计算qbeta的算法未针对这些参数值收敛.

The reason for the error is that the algorithm used to calculate qbeta did not converge for those values of the parameters.

R使用AS 109来计算qbeta(Cran,GW,KJ Martin和GE Thomas(1977).注释AS R19和算法AS 109,Applied Statistics,26、111–114和后续注释(AS83和更正). ). R尝试在1000次迭代中计算该值.如果它不能进行1000次迭代,则您将看到错误消息.

R uses AS 109 to calculate qbeta (Cran, G. W., K. J. Martin and G. E. Thomas (1977). Remark AS R19 and Algorithm AS 109, Applied Statistics, 26, 111–114, and subsequent remarks (AS83 and correction).). R tries to calculate the value in 1000 iterations. If it cannot in the 1000 iterations, you get the error message you saw.

这是 qbeta 的代码

这篇关于在"qbeta"中可能未达到完全精度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆