[R] qmvnorm function

Rui Barradas rui1174 at sapo.pt
Thu Mar 15 02:02:56 CET 2012


Hello,

>
> Thanks Rui.
> 
> Sorry I forgot to mention what is the "var" in the previous message. It
> seems
> that when the correlation is small, it does not work.
> See below.
> 

It works in my system: (your first example)

var <- matrix(c(1,0.05,0.05,1), nrow=2, ncol=2, byrow=T)
var
     [,1] [,2]
[1,] 1.00 0.05
[2,] 0.05 1.00
qmvnorm(0.05, tail="upper", sigma=var)$quantile
[1] 0.7934487

It also worked with the other two examples. System? Package version?

My system is

> R.version
               _                            
platform       i386-pc-mingw32              
version.string R version 2.14.1 (2011-12-22)

And the package mvtnorm version is 0.9-9991, the current CRAN is 0.9-9992

Anyway, I've tried it with the 'interval' parameter. Note the difference in
iterations to convergence

#var <- matrix(c(1,0.05,0.05,1), nrow=2, ncol=2, byrow=T)
#var
qmvnorm(0.05, tail="upper", sigma=var)
$quantile
[1] 0.7934487

$f.quantile
[1] -2.719625e-07
attr(,"error")
[1] 1e-15
attr(,"msg")
[1] "Normal Completion"

$iter
[1] 12

$estim.prec
[1] 6.103516e-05

 
qmvnorm(0.05, interval=c(0, 5), tail="upper", sigma=var)
$quantile
[1] 0.793449

$f.quantile
[1] -3.152414e-07
attr(,"error")
[1] 1e-15
attr(,"msg")
[1] "Normal Completion"

$iter
[1] 9

$estim.prec
[1] 6.103516e-05

Your problem seems to be with, at least, 'uniroot'. Give it a help and it
might work.

Rui Barradas



--
View this message in context: http://r.789695.n4.nabble.com/qmvnorm-function-tp4473262p4473638.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list