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

A bug in calibrateGroup #170

Open
ggamit opened this issue Nov 24, 2024 · 0 comments
Open

A bug in calibrateGroup #170

ggamit opened this issue Nov 24, 2024 · 0 comments

Comments

@ggamit
Copy link

ggamit commented Nov 24, 2024

When running CohortMethod with multiple analyses, if there are no negative control outcomes, but a large number (>4) of outcomes of interest, summarizeResults fails with the following error:

Error in optim(c(0, 100), logLikelihoodNullMcmc, logRr = logRr, seLogRr = seLogRr) :
function cannot be evaluated at initial parameters

The reason is that in the function calibrateGroup, called by runCmAnalyses->summarizeResults->calibrateEstimates:
the line:
ncs <- group[group$trueEffectSize == 1 & !is.na(group$seLogRr), ]
is returning a non-empty empty tibble even if there are no negative control outcomes (because NA==1 returns NA and not FALSE).
This causes the condition if (nrow(ncs) >= 5) to be TRUE even though there is no need to compute the systematic error.

it should be corrected, similarly to the next line, to:
ncs <- group[!is.na(group$trueEffectSize) & group$trueEffectSize == 1 & !is.na(group$seLogRr), ]

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

No branches or pull requests

1 participant