##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
corr=diag(4)
corr12=0.3508
corr[1,2]=corr12
corr[2,1]=corr12
corr13=0.3508
corr[1,3]=corr13
corr[3,1]=corr13
corr14=0.4979
corr[1,4]=corr14
corr[4,1]=corr14
corr23=0.3016
corr[2,3]=corr23
corr[3,2]=corr23
corr24=0.5630
corr[2,4]=corr24
corr[4,2]=corr24
corr34=0.5630
corr[3,4]=corr34
corr[4,3]=corr34
quantile=c(0.4308,0.9804,1.8603)
k=c(-200,quantile)
# -200 is small enough to send the lower bound to be -Inf
alphaofx=pmvnorm(lower=c(-200,quantile),corr=corr)
multistageselection(k=c(-200,quantile),corr=corr,alphaofx,sumdimofxandy=4)
#####
# new code for adapt the window input of the red-R
#####
k=c(-200,0.4308,0.9804,1.8603)
corr=matrix( c(1, 0.3508,0.3508,0.4979,
0.3508 ,1, 0.3016,0.5630,
0.3508, 0.3016,1 ,0.5630,
0.4979, 0.5630,0.5630,1),
nrow=4
)
sumdimofxandy=4
alphaofx=pmvnorm(lower=k,corr=corr)
multistageselection(k=k,corr=corr,alphaofx,sumdimofxandy=4)
selection.var.time.miwa=system.time (var.miwa<-multistagevariance(k=k,corr=corr,alphaofx,sum.dim=4,alg=Miwa))
selection.var.time.bretz=system.time (var.bretz<-multistagevariance(k=k,corr=corr,alphaofx,sum.dim=4))
selection.var.time.miwa
var.miwa[1]
selection.var.time.bretz
var.bretz[1]
# further examples 1
k=c(-200,0.9674216, 1.6185430)
corr=matrix( c(1, 0.7071068, 0.9354143,
0.7071068, 1, 0.7559289,
0.9354143, 0.7559289, 1
),
nrow=3
)
sum.dim=3
alphaofx=pmvnorm(lower=k,corr=corr)
multistagegain(k=k,corr=corr,alphaofx,sum.dim=3)
multistagegain(k=k,corr=corr,alphaofx,sum.dim=3,stages=TRUE)
multistagevariance(k=k,corr=corr,alphaofx,sum.dim=3,alg=Miwa)
selection.var.time.miwa=system.time (var.miwa<-multistagevariance(k=c(-200,quantile),corr=corr,alphaofx,sum.dim=3,alg=Miwa))
selection.var.time.bretz=system.time (var.bretz<-multistagevariance(k=c(-200,quantile),corr=corr,alphaofx,sum.dim=3))
selection.var.time.miwa
var.miwa[1]
selection.var.time.bretz
var.bretz[1]
# further examples 2
alpha1<- 1
alpha2<- 1/24
Q=calculatefromalpha(alpha=c(alpha1,alpha2),dim=2,corr=corr[2:3,2:3])
k=c(-200,Q)
corr=matrix( c(1, 0.7071068, 0.9354143,
0.7071068, 1, 0.7559289,
0.9354143, 0.7559289, 1
),
nrow=3
)
sum.dim=3
alphaofx=pmvnorm(lower=k,corr=corr)
multistagegain(k=k,corr=corr,alphaofx,sum.dim=3)
multistagegain(k=k,corr=corr,alphaofx,sum.dim=3,stages=TRUE)
multistagevariance(k=k,corr=corr,alphaofx,sum.dim=3,alg=Miwa)
# further examples 3 for the paper
alpha1<- 1/6
alpha2<- 1/4
Q=calculatefromalpha(alpha=c(alpha1,alpha2),dim=2,corr=corr[2:3,2:3])
k=c(-200,Q)
corr=matrix( c(1, 0.7071068, 0.9354143,
0.7071068, 1, 0.7559289,
0.9354143, 0.7559289, 1
),
nrow=3
)
sum.dim=3
alphaofx=pmvnorm(lower=k,corr=corr)
multistagegain(k=k,corr=corr,alphaofx,sum.dim=3)
multistagegain(k=k,corr=corr,alphaofx,sum.dim=3,stages=TRUE)
multistagegain.each(k=k,corr=corr,alphaofx,sum.dim=3)
multistagevariance(k=k,corr=corr,alphaofx,sum.dim=3,alg=Miwa)
# further examples 4 for the paper
alpha1<- 1/(24)^0.5
alpha2<- 1/(24)^0.5
Q=calculatefromalpha(alpha=c(alpha1,alpha2),dim=2,corr=corr[2:3,2:3])
k=c(-200,Q)
corr=matrix( c(1, 0.7071068, 0.9354143,
0.7071068, 1, 0.7559289,
0.9354143, 0.7559289, 1
),
nrow=3
)
sum.dim=3
alphaofx=pmvnorm(lower=k,corr=corr)
multistagegain(k=k,corr=corr,alphaofx,sum.dim=3)
multistagegain(k=k,corr=corr,alphaofx,sum.dim=3,stages=TRUE)
multistagegain.each(k=k,corr=corr,alphaofx,sum.dim=3)
multistagevariance(k=k,corr=corr,alphaofx,sum.dim=3,alg=Miwa)
Run the code above in your browser using DataLab