Full accuracy may not have been achieved in 'qbeta'

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

I am trying to simulate correlated beta-distributed data. The method that I use is an extension of what is written in this article:

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

  • Basically, I start by modeling multidimensional normal data (using the mvrnorm() function from MASS).
  • Then I use pnorm() to apply the probit conversion to this data, so my new data vector lives in (0,1). And they are still correlated in accordance with the previous statement.
  • Then, given this transformed data is broken qbeta() , I use the qbeta() function with certain parameters shape1 and shape2 to return correlated beta data with certain average and dispersion properties.

I know that there are other ways to generate correlated beta data. I am wondering why qbeta() makes this method fail for certain "seeds". The following is the error message.

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

What does it mean? How can it be avoided? When this happens in the context of a larger simulation, what is the best way to ensure that this problem does not complete all the source code (using the source code)?

I ran the following code for whole seeds from 1: 1000. Seed = 899 was the only value that gave me problems. Although, if it is problematic here, it will inevitably be problematic for other seeds.

 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) 

The above code is part of a larger modeling project. But the qbeta () warning is what gives me a headache right now.

Any help the group can provide would be greatly appreciated.

Greetings Chris

+6
source share
1 answer

The cause of the error is that the algorithm used to calculate qbeta did not converge for these parameter values.

R uses AS 109 to calculate qbeta (Cran, GW, KJ Martin and GE Thomas (1977). Note AS R19 and AS 109, Applied Statistics, 26, 111-114 and subsequent notes (AS83 and correction).). R is trying to compute a value of 1000 iterations. If it cannot in 1000 iterations, you will receive the error message that you saw.

Here is the qbeta code.

+2
source

Source: https://habr.com/ru/post/947126/


All Articles