OHDSI / SelfControlledCaseSeries

An R package for performing Self-Controlled Case Series (SCCS) analyses in an observational database in the OMOP Common Data Model.
http://ohdsi.github.io/SelfControlledCaseSeries
13 stars 8 forks source link

Attempting to handle case when Cyclops model fit returns all `NA` estimates #55

Closed anthonysena closed 4 months ago

anthonysena commented 4 months ago

I'm not sure if this patch is acceptable but the edge-case here is the following:

    fit <- tryCatch(
      {
        Cyclops::fitCyclopsModel(cyclopsData, prior = prior, control = control)
      },
      error = function(e) {
        e$message
      }
    )

The fit$estimates$estimate_value (not sure if my variable names are 100% right) are all NA which then causes problems downstream when attempting to call Cyclops::getCyclopsProfileLogLikelihood, specifically here since the with the error "missing value where TRUE/FALSE needed".

I believe that this is due to the model being ill-conditioned and so I've added a check for the fit$return_flag to skip the log likelihood in this case.

anthonysena commented 4 months ago

This will be addressed in Cyclops vs. in SCCS so closing this out.