Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question on digits display when summarizing a design #505

Open
LittleBeannie opened this issue Mar 5, 2025 · 1 comment
Open

Question on digits display when summarizing a design #505

LittleBeannie opened this issue Mar 5, 2025 · 1 comment
Labels
question Further information is requested

Comments

@LittleBeannie
Copy link
Collaborator

Hi @jdblischak , when I run the following lines of code, I notice that the 'Cumulative boundary crossing probability' isn't showing 5 digits. Could you help me understand why?

gs_design_ahr(analysis = c(24, 36, 48)) |> 
   summary(col_decimals = c(z = 5, probability = 5,  probability0 = 5,  `~hr at bound` =  5, `nominal p` = 5)) |> 
   as_gt()

Image

@LittleBeannie LittleBeannie added the question Further information is requested label Mar 5, 2025
@jdblischak
Copy link
Collaborator

First I confirmed this is a problem by trying to limit to 3 decimal places:

gs_design_ahr(analysis = c(24, 36, 48)) |> 
  summary(col_decimals = c(z = 3, probability = 3,  probability0 = 3,  `~hr at bound` =  3, `nominal p` = 3)) |> 
  as_gt()

I suspected this was a problem with the names, and indeed it is. You have to use the column names Alternate hypothesis and Null hypothesis:

gs_design_ahr(analysis = c(24, 36, 48)) |> 
  summary(col_decimals = c(z = 5, `Alternate hypothesis` = 5,  `Null hypothesis` = 5,  `~hr at bound` =  5, `nominal p` = 5)) |> 
  as_gt()

This is defined here:

gsDesign2/R/summary.R

Lines 343 to 349 in a33d657

# Prepare the columns decimals ----
default_decimals <- c(NA, NA, 2, if (method != "combo") 4, 4, 4, 4)
default_vars <- c(
"analysis", "bound", "z",
sprintf("~%s at bound", switch(method, ahr = "hr", wlr = "whr", rd = "risk difference")),
"nominal p", "Alternate hypothesis", "Null hypothesis"
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants