This release fix one command in fix effect model analysis of main effect that is confusing.

- I fixed the bug in function
`resultrtostats`

. THe calculation of “stats4” was the sum of main effect and interaction effect when using the model with interaction term (main * stage_continuous / main * stage_discrete). The sum was used to calculate the posterior probability of superior or inferior. However, “stats4” only represents the mean values of main effect in the final output matrix. The wrong value was given to “stats4”. This is the same for “stats5” which is the standard errors of the main effect in the model

This release fix two bugs.

- I fixed the bug in function
`GP.optim`

where the formula of information weighed randomisation is wrong. - I fixed the bug in function
`demo_Cutoffscreening`

where the nextcutoff vector for sample may have only one element. This will lead to the error in function`sample`

when you only want to sample one value greater than 1. The argument ‘ntrials’ in each example should be large (> 100) instead 2 to make the example more like an actual simulation example. I use ntrials = 2 in the example to speed up the check process.

This release fix one bug reported by the cran team.

- I fixed the bug in function
`GP.optim`

where the nextcutoff vector for sample may have only one element. This will lead to the error in function`sample`

when you only want to sample one value greater than 1. - The argument ‘ntrials’ in each example should be large (> 100) instead 2 to make the example more like an actual simulation example. I use ntrials = 2 in the example to speed up the check process.

This release implements additional method of cutoff screening using Bayesian optimization.

Add a new Demo function called

`demo_Cutoffscreening_GP`

. The function indicates how to use Gaussian process-based Bayesian optimisation algorithm to calibrate the critical value for stopping boundary under the null scenario to control the Type I error rate or FWER before trial simulation.Add a function

`GP_optim`

which returns a cutoff value for the next evaluation during the cutoff screening process. The function is used in demo`demo_Cutoffscreening_GP`

.

- I found that the output data matrix can not be generated when there are four arm, the ‘variable.inf’ = “Mixeffect” and ‘reg.inf’ is “main”/“main + stage_continuous”/“main * stage_discrete”. It only work for ‘variable.inf’=“Mixeffect” and ‘reg.inf = main + stage_discrete’. The reason why this happen is that the length of stats6 and stats7 variable are not generated correctly at stage 1 since the fixed effect model is used for ‘variable.inf’=“Mixeffect” at stage 1 to speed up the simulation.

- I add one ifelse command to enforce the generation of stats6 and stats7 when ‘variable.inf’=“Mixeffect”. It does not depend on the value of ‘reg.inf’ now.

I fixed a bug where the fix ratio allocation method code is not suitable for the multi-arm trial

Old code: rpk[-1] = rep((armleft - 1) / (armleft - 1 + Fixratiocontrol), armleft - 1)

New code: rpk[-1] = rep(1 / (armleft - 1 + Fixratiocontrol), armleft - 1)

I added a check command for max.ar which is the upper boundary for randomisation ratio for each arm. The command is added in the MainFunction.R. Details are shown below.

#-max.ar check if (1 - max.ar > 1/K){ stop(“Error: The lower allocation ratio should be at least 1/K. Please check the number of arm at the beginning and the max.ar”) }

Another change is the randomisation ratio adjustment in the Simulation_AdaptiveRandomisationmethodRatioCalc.R.

I modified the randomisation ratio adjustment command for Thall’s approach.

##—-Original code—— (This code only protects the control arm’s allocation ratio)

rpk = matrix(rep(0, armleft), ncol = armleft)

randomprob = matrix(rep(0, K), ncol = K)

colnames(rpk) = c(1, treatmentindex + 1)

colnames(randomprob) = seq(1, K)

rpk[1] = alloc.prob.best[1]

rpk[-1] = alloc.prob.best[-1][treatmentindex]

rpk = rpk / sum(rpk)

lower = ifelse(rpk[1] < (1 - max.ar), 1 - max.ar, rpk[1])

rpk[1] = lower

upper = ifelse(rpk[1] > max.ar, max.ar, rpk[1])

rpk[1] = upper

rpk[-1] = (1 - rpk[1]) * rpk[-1] / sum(rpk[-1])

randomprob[as.numeric(colnames(rpk))] = randomprob[as.numeric(colnames(rpk))] + rpk

##—-New code—— (This code protects all arms’ allocation ratio. Also, this code work together with max.ar check code)

rpk = matrix(rep(0,armleft),ncol = armleft)

randomprob = matrix(rep(0,K),ncol = K)

colnames(rpk) = c(1,treatmentindex+1)

colnames(randomprob) = seq(1,K)

rpk[1] = alloc.prob.best[1]

rpk[-1] = alloc.prob.best[-1][treatmentindex]

rpk = rpk/sum(rpk)

lower = ifelse(rpk<(1-max.ar),1-max.ar,rpk)

rpk = lower

upper = ifelse(rpk>max.ar,max.ar,rpk)

rpk = upper

rpk[!(rpk==(1-max.ar))]=(1-sum(rpk[rpk==1-max.ar]))*(rpk[!(rpk==1-max.ar)]/sum(rpk[!(rpk==1-max.ar)]))

randomprob[as.numeric(colnames(rpk))] = randomprob[as.numeric(colnames(rpk))]+rpk