-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fix a typo: seq_along()
should have been seq_len()
#447
Conversation
This fixes the macOS issue of simtrial on GHA: Merck/simtrial#262 When `n_analysis = 2`, `seq_along(n_analysis)` is `1`, and only the first `n` in `x_new$analysis` is rounded. We should have rounded all elements in `n` that are close enough to integers, so the loop should go from `1` to `n_analysis`, i.e., the looping indices should be `seq_len(n_analysis)`.
I confirmed that this continues to work on Windows. I installed {gsDesign2} from this PR along with the latest version of {simtrial}. I then ran |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @yihui !
You are welcome! |
@LittleBeannie I forgot to ask a question: since |
Hi Yihui, thanks for sharing your insights. Following please find my explanation of the sample size/events. The calculation of sample size is based on the targeted power. For example, we target for 90% power, which require for 100 statistical information (1/variance). To get exactly 100 statistical information, the sufficient sample size is 300.4 (non-integer). If users prefer to get integer sample size, then we will around it to 302 (if it is equal randomization), which will gives you statistical information slightly larger than 100, leading to a power slightly over 90%.
|
Thanks for the explanation! I understand it better now. My question was specifically for the function |
I guess it is a numerical issue...where I am struggling with.... Following please find a toy example to demonstrate the logical of
|
Okay, I understand the logic now. Unfortunately, I think that's impossible for computers---you can't expect that The above logic can be simplified to: c = a * b
c2 = f(c)
a2 = a * c2 / c What you were trying to achieve is
Now the question boils down to whether e = sqrt(.Machine$double.eps)
x = runif(10000, 0, 1e8)
y = runif(10000, 0, 1e8)
d = x / y * y - x
i = abs(d) < e
all(i) # likely to be FALSE
plot(x, y, pch = ifelse(i, '.', 'x')) So it's impossible to make the plot(abs(d), las = 1) Perhaps you can check with Keaven to see if this makes sense. |
Thanks, @yihui for the detailed clarification. I will follow-up with Keaven when he is back. |
This fixes the macOS issue of simtrial on GHA: Merck/simtrial#262
When
n_analysis = 2
,seq_along(n_analysis)
is1
, and only the firstn
inx_new$analysis
is rounded. We should have rounded all elements inn
that are close enough to integers, so the loop should go from1
ton_analysis
, i.e., the looping indices should beseq_len(n_analysis)
.This problem was originally introduced by d0159b9.