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) } --------------------------------- [[alternative HTML version deleted]]
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 --------------------------------- [[alternative HTML version deleted]]
house-ball wrote:>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. > > >First, you should probably read "An Introduction to R" which comes with your R-installation. As posed your question is ambiguous, but assuming you mean to say "normal distribution", you need something like qnorm(0.05) or if you mean probability in the upper tail qnorm(0.05, lower.tail=FALSE) Then read ?qnorm Kjetil halvorsen> > >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) > >} > > > > >---------------------------------> [[alternative HTML version deleted]] > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > > > >-- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra
Hi, Would you help me solve the following question? Thanks. my program is as follows:> library(mvtnorm)> value<-pmvnorm(lower=-Inf, upper=-2.178, mean=0, sigma=1)+ pmvnorm(lower=2.178, upper=Inf, mean=0, sigma=1)+ pmvnorm(lower=c(-2.178,-Inf),upper=c(2.178,-2.178),mean=0,corr=diag(2)*sqrt(0.5))+ pmvnorm(lower=c(-2.178,2.178),upper=c(2.178,Inf),mean=0,corr=diag(2)*sqrt(0.5))> value[1] 0.05794736 Now if I try to set the probability=0.05 and find the approximate critical value. (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. Would you check out what¡¦s a problem with my program ? Thanks. 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 --------------------------------- [[alternative HTML version deleted]]
Hi, Would you help me solve the following question? Thanks. my program is as follows:> library(mvtnorm)> value<-pmvnorm(lower=-Inf, upper=-2.178, mean=0, sigma=1)+ pmvnorm(lower=2.178, upper=Inf, mean=0, sigma=1)+ pmvnorm(lower=c(-2.178,-Inf),upper=c(2.178,-2.178),mean=0,corr=diag(2)*sqrt(0.5))+ pmvnorm(lower=c(-2.178,2.178),upper=c(2.178,Inf),mean=0,corr=diag(2)*sqrt(0.5))> value[1] 0.05794736 Now if I try to set the probability=0.05 and find the approximate critical value. (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. Would you check out what¡¦s a problem with my program ? Thanks. 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 --------------------------------- [[alternative HTML version deleted]]
house-ball wrote: Why do you repeat an unclear question fou times? Please read the posting guide. It is not clear what is your problem. Kjetil halvorsen>Hi, > >Would you help me solve the following question? Thanks. > >my program is as follows: > > > >>library(mvtnorm) >> >> > > > >>value<-pmvnorm(lower=-Inf, upper=-2.178, mean=0, sigma=1)+ pmvnorm(lower=2.178, upper=Inf, mean=0, sigma=1)+ pmvnorm(lower=c(-2.178,-Inf),upper=c(2.178,-2.178),mean=0,corr=diag(2)*sqrt(0.5))+ pmvnorm(lower=c(-2.178,2.178),upper=c(2.178,Inf),mean=0,corr=diag(2)*sqrt(0.5)) >> >> > > > >>value >> >> > >[1] 0.05794736 > > > >Now if I try to set the probability=0.05 and find the approximate critical value. (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. Would you check out what????s a problem with my program ? Thanks. > > > >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 > > > > >---------------------------------> [[alternative HTML version deleted]] > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > > > >-- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra