Hi,

Would you help me solve the following question? Thanks.

 

Question: If I try to set the probability=0.05 and find the approximate x. (The answer 
should be somewhere between 2.1782 and 2.1783.)

I write about this R program as follows but I don’t know how to get the value of x 
which is between 2.1782 and 2.1783.

 

library(mvtnorm)

value<-array(1000)

a<-array(1000)

 

a<-seq(2,3,by=0.001)                   

for(i in 1000)

{

 x<-a[i]

 value[i]<-2*(pmvnorm(lower=-Inf, upper=-x, mean=0, sigma=1)+

              pmvnorm(lower=c(-x,-Inf),upper=c(x,-x),mean=0,corr=diag(2)*sqrt(0.5)))

 if(value[i]-0.05<0.001) 

 print(x)

}

 

Chia-Yi




---------------------------------
Yahoo!奇摩Messenger6.0
[EMAIL PROTECTED]
立即下載更新最新版!
        [[alternative HTML version deleted]]

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to