Fix gsSurvPower timing criteria - #303
Conversation
| # whether the gsSurv alpha/sided convention applies. | ||
| alpha_provided_by_user <- !is.null(alpha) | ||
| minfup_provided_by_user <- "minfup" %in% names(call_args) && | ||
| !is.null(call_args$minfup) |
There was a problem hiding this comment.
This type of code sounds off alarm bells to me. It shouldn't be this complex to determine if a user supplied an argument. Instead you can do the exact same thing in the line above for determining if alpha was supplied directly to gsSurvPower():
alpha_provided_by_user <- !is.null(alpha)
minfup_provided_by_user <- !is.null(minfup)In general, having these arguments behave differently whether they are directly supplied as an argument to gsSurvPower() or passed via x makes it hard to reason about. There is a comment explaining why this must be done for alpha. Is there a reason why minfup should be ignored if it is supplied via x?
There was a problem hiding this comment.
The only valid reason I can think of using such a condition is for backward compatibility. For example, minfup and T defaults were changed in gsDesign 3.6.0 (#105), which breaks people's code if they didn't supply the argument before and run under the new version. Not sure if it's necessary here, though.
Fundamentally, I think this is because these are, perhaps inherently, required arguments, and required args shouldn't have defaults.
There was a problem hiding this comment.
I don't think we need to worry about backwards compatibility here. The default for gsSurvPower() has always been minfup = NULL. Thus is if we want to know if the user supplied it, the simpler !is.null(minfup) will suffice. No need to dynamically obtain the supplied arguments via match.call().
Summary
minfup=...ingsSurvPowermay not working...? #291, Conflicts ofRandtargetNingsSurvPower()#293, Shall we usemaxExtensionalong withplannedCalendarTimeandtargetEventsingsSurvPower()? #295, and Can we decide the analysis timing by minimal total sample and minimum follow-up time after the minimal total sample size is reached ingsSurvPower()? #296.Closes #291.
Closes #293.
Closes #295.
Closes #296.
Checks