# 1. This program computes the expected sample size, type I error rate and power # in Section 3 of the paper &"On Construction of Two-Stage Designs with # Consideration of Both Response and Toxicity&" (Yin, Wang and Zhang). It confirms # the results in Table 3.# 2. The expected sample size, type I error rate and power are computed with data (X and Y), # where X=(X11,X10,X01) is a multinomial variable Multinom(n1,p) in Stage I, and # Y=(Y11,Y10,Y01) is Multinom(n2,p) in Stage II for p=(p11,p10,p01). # Two probabilities, the probability of response pr=p11+p10 and the probability of nontoxcity # pt=p11+p01, are introduced in Table 1.# 3. The rejection region is R_m (Case A). # P(R_A) = P( X11+X10>=ar, X11+X10+Y11+Y10>=cr, X11+X01>=at, X11+X01+Y11+Y01>=ct)# 4. The expected sample size in H0 is calculated at two points, p*r0 and p*t0 (introduced # in Theorem 2) , and we record the larger value.# The maximum type I error rate of the test R_m is achieved at two points, p*r0 and p*t0, and # we record the larger one.# The minimum power is at a line p*A, introduced in Theorem 3. # Here, (pr,pt,p11)=(pr0,1,pr0)=p*r0 and (pr,pt,p11)=(1,pt0,pt0)=p*t0.# 5. The input is f(pr0,pt0,pr1,pt1,n1,ar,at,n2,cr,ct), # a function of pr0, pt0, pr1, pt1, n1, ar, at, n2, cr, ct,# where # a) pr0,pt0,pr1,pt1, for four boundries of hypotheses in (1) of the paper;# b) n1, for the sample size in Stage I;# c) n2, for the sample size in Stage II;# d) ar and at, for moving into Stage II from Stage I. i.e., if Xr belongs to # [ar,n1) or Xt belongs to [at,n1), the trial moves into Stage II;# e) cr and ct, for th代做Matlat程设计、R语言帮做、代做C/C++实验、Python编程作业代做、代写Matlat作业e Stage II critical values.# 6. The three output values include: # a) the bigger value of the expected sample sizes at p*r0 and p*t0;# b) the maximum type I error rate;# c) the minimum power.# 7. For example,# input: f(0.5,0.7,0.7,0.9,14,8,11,26,24,33)# output: 24.2768555 0.1074260 0.8026355RES1)|any(prob 1)stop(&"Sum of P must not be greater than 1.&") if(any( Rn]=n+1 sump=0if(R[1]1]=1for(i in (0:r1)){if(b==1) sump n)return(0)if((j*r)==n){pj =ar x11+x01>=at) {sam=rbind(sam,c(x11,x10,x01,x00))}}}sam}SS1=ar Xt>=atSS1=ar x11+x01>=at) {sam=rbind(sam,c(x11,x10,x01,x00))}}}}sam}SSS1=ar Xt>=atSSS1=1-beta)# RESS# if(length(aa)==1) RESS# bb# cc# RESS# RESS###################### Jins ######################tim=Sys.time()f(0.5,0.7,0.7,0.9,15,9,12,29,25,36) # this is the output of the expected sample size, type I error and powerSys.time()-tim# EN TypeIerror Power# [1,] 23.80496 0.140913 0.7927383tim=Sys.time()f(0.5,0.7,0.7,0.9,20,12,16,16,21,30) # this is the output of the expected sample size, type I error and powerSys.time()-tim# [1] 24.0275574 0.1400109 0.7955622tim=Sys.time()f(0.5,0.7,0.7,0.9,14,8,11,26,24,33) # this is the output of the expected sample size, type I error and powerSys.time()-tim# [1,] 24.27686 0.107426 0.8026355&

需要的下面留言,一天之内会有回复

本博客所有文章如无特别注明均为原创。
复制或转载请以超链接形式注明转自起风了,原文地址《代做Matlat程设计、R语言帮做、代做C/C++、Python编程代做、代写Matlat
   

还没有人抢沙发呢~