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.


> 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
Error in uniroot(pfct, interval = interval) :
  f() values at end points not of opposite sign
>
> var <- matrix(c(1,0.1,0.1,1), nrow=2, ncol=2, byrow=T)
> var
     [,1] [,2]
[1,]  1.0  0.1
[2,]  0.1  1.0
> qmvnorm(0.05, tail="upper", sigma=var)$quantile
Error in uniroot(pfct, interval = interval) :
  f() values at end points not of opposite sign
>
> var <- matrix(c(1,0.2,0.2,1), nrow=2, ncol=2, byrow=T)
> var
     [,1] [,2]
[1,]  1.0  0.2
[2,]  0.2  1.0
> qmvnorm(0.05, tail="upper", sigma=var)$quantile
[1] 0.8935925
>


ÔÚ 2012Äê3ÔÂ14ÈÕ ÏÂÎç6:37£¬Rui Barradas <rui1...@sapo.pt>дµÀ£º

> Hello,
>
> li li-13 wrote
> >
> > Dear all,
> >    I need to use the "qmvnorm" function in mtvnorm package.
> >
> > Here is the error message I got
> >> qmvnorm(0.05, tail="upper", sigma=var)$quantile
> > Error in uniroot(pfct, interval = interval) :
> >   f() values at end points not of opposite sign
> >
> > There is no problem for 50th quantile.
> >> qmvnorm(0.5, tail="upper", sigma=var)$quantile
> > [1] -0.5325527
> >
> > Can anyone give some hint regarding this?
> >
> >  Thanks.
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help@ mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
> The problem seems to be in the value of 'var'.
>
> > qmvnorm(0.05, tail="upper", sigma=diag(2))$quantile
> [1] 0.7600695
> > qmvnorm(0.05, tail="upper", sigma=diag(5))$quantile
> [1] -0.123829
>
> >From these results, there is nothing intrisically wrong with the quantile
> 0.05.
>
> In the error message, 'uniroot' is not in an interval with a guaranteed
> solution, maybe
> the parameter 'interval' of 'qmvnorm' will put it in the right track.
>
> Hope this helps,
>
> Rui Barradas
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/qmvnorm-function-tp4473262p4473364.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to