# tradeoff_square: Functions for integration for Bayesian loss methodology In finite2/Eurosarc_bayes: Bayesian Single Arm Sample Size Calculation Software

## Description

An integral and graph for an acceptable region for the bayesian loss function approach (see `bayes_binom_two_loss`)

## Usage

 ```1 2 3 4``` ```tradeoff_square_integrate(ar, br, at, bt, efficacy_region_min, toxicity_region_max) tradeoff_square_graph(input) ```

## Arguments

 `ar, br` Parameters for the posterior distribution for response `at, bt` Parameters for the posterior distribution for toxicity `efficacy_region_min` Smallest acceptable efficacy `toxicity_region_max` Largest acceptable toxicity `input` A list values needed for the graph. It is expecting max.patients, efficacy_region_min, toxicity_region_max and will error without

## Value

Returns value of the integration.

## References

Chen Y, Smith BJ. Adaptive group sequential design for phase II clinical trials: a Bayesian decision theoretic approach. Stat Med 2009; 28: 3347-3362.

`bayes_binom_two_loss`
Integration functions and corresponding graphs: `tradeoff_square_integrate`,`tradeoff_ellipse_integrate`,`tradeoff_linear_integrate`,`tradeoff_ratio_integrate`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34``` ```# modelled toxicity probability t=c(0.1,0.1,0.3,0.3) # modelled response probability r=c(0.35,0.2,0.2,0.35) reviews=c(10,15,20,25,30,35,40) stage_after_trial=40 # uniform prior pra=1;prb=1;pta=1;ptb=1 efficacy_critical_value=0.2 futility_critical_value=0.35 toxicity_critical_value=0.1 no_toxicity_critical_value=0.3 # alpha/beta ratio l_alpha_beta=3 # cost of continuing compared to cost of alpha l_alpha_c=750 efficacy_region_min=0.2 toxicity_region_max=0.3 ######################################## # square region s=bayes_binom_two_loss(t,r,reviews,pra,prb,pta,ptb,l_alpha_beta, l_alpha_c,stage_after_trial,fun.integrate=tradeoff_square_integrate, fun.graph=tradeoff_square_graph,efficacy_critical_value, toxicity_critical_value,futility_critical_value, no_toxicity_critical_value,efficacy_region_min=efficacy_region_min, toxicity_region_max=toxicity_region_max) plot(s) ```