Skip to content

Symmetric design: issue with to_integer #516

Closed
@LittleBeannie

Description

@LittleBeannie

The following code generates a symmetric design.

> (gs_design_ahr(analysis_time = 36, info_frac = 1:3/3, 
+               upper = gs_spending_bound, 
+               upar = list(sf = sfLDOF, total_spend = 0.025), 
+               lower = gs_spending_bound, 
+               lpar = list(sf = sfLDOF, total_spend = 0.025), 
+               binding = TRUE, h1_spending = FALSE))$bound
# A tibble: 6 × 7
  analysis bound probability probability0     z `~hr at bound` `nominal p`
     <int> <chr>       <dbl>        <dbl> <dbl>          <dbl>       <dbl>
1        1 upper  0.00450        0.000104  3.71          0.476    0.000104
2        1 lower  0.00000100     0.000104 -3.71          2.10     1.00    
3        2 upper  0.382          0.00605   2.51          0.701    0.00601 
4        2 lower  0.00000213     0.00605  -2.51          1.43     0.994   
5        3 upper  0.900          0.0250    1.99          0.795    0.0231  
6        3 lower  0.00000218     0.0250   -1.99          1.26     0.977   

After applying to_integer() to the above design, the boundaries are not symmetrical anymore.

> (gs_design_ahr(analysis_time = 36, info_frac = 1:3/3, 
+               upper = gs_spending_bound, 
+               upar = list(sf = sfLDOF, total_spend = 0.025), 
+               lower = gs_spending_bound, 
+               lpar = list(sf = sfLDOF, total_spend = 0.025), 
+               binding = TRUE, h1_spending = FALSE) %>% 
+     to_integer())$bound
# A tibble: 6 × 7
  analysis bound probability probability0      z `~hr at bound` `nominal p`
     <int> <chr>       <dbl>        <dbl>  <dbl>          <dbl>       <dbl>
1        1 upper    0.00439      0.000101  3.72           0.473    0.000101
2        1 lower    0.000109     0.00405  -2.65           1.70     0.996   
3        2 upper    0.378        0.00596   2.52           0.698    0.00593 
4        2 lower    0.00597      0.378    -0.311          1.05     0.622   
5        3 upper    0.901        0.0250    1.99           0.793    0.0232  
6        3 lower    0.0250       0.900     1.28           0.861    0.0998     

Thanks @yihui, for discovering this issue during the shiny app development.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions