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

Implement ssd_fit_dists() with right censored data #207

Open
joethorley opened this issue Jun 7, 2021 · 5 comments
Open

Implement ssd_fit_dists() with right censored data #207

joethorley opened this issue Jun 7, 2021 · 5 comments

Comments

@joethorley
Copy link
Collaborator

No description provided.

@joethorley
Copy link
Collaborator Author

  library(ssdtools)
  data <- ssdtools::boron_data
  
  data$right <- data$Conc
  data$right[1] <- Inf
  
  ssd_fit_dists(data, dists = "lnorm", right = "right")
#> Error: Distributions cannot currently be fitted to right censored data.

Created on 2021-08-02 by the reprex package (v2.0.0)

@joethorley joethorley changed the title Get working with right censored data Implement ssd_fit_dists() with right censored data Aug 2, 2021
@joethorley joethorley changed the title Implement ssd_fit_dists() with right censored data Implement ssd_fit_dists() with right censored data Aug 2, 2021
@joethorley
Copy link
Collaborator Author

Note if switch off check then get the following

  library(ssdtools)
  data <- ssdtools::boron_data
  
  data$right <- data$Conc
  data$right[1] <- Inf
  
  ssd_fit_dists(data, dists = "lnorm", right = "right")
#> Warning: Distribution 'lnorm' failed to fit (try rescaling data): Error in optim(model$par, model$fn, model$gr, method = "L-BFGS-B", lower = lower,  : 
#>   non-finite value supplied by optim
#> .
#> Error: All distributions failed to fit.

Created on 2021-08-02 by the reprex package (v2.0.0)

@joethorley
Copy link
Collaborator Author

The issue is handling the infinite values in the TMB C++ code.

Really just need to replace existing code

pright = pnorm(log(right(i)), meanlog, sdlog);

with

pright = 1;
if(isfinite(right(i))){ pright=pnorm(log(right(i)), meanlog, sdlog);};

@joethorley joethorley removed their assignment Aug 3, 2021
@beckyfisher
Copy link
Contributor

Hi Joe, I'm playing around with a data set with right censored values, is this still on the list of things to implement?

@joethorley
Copy link
Collaborator Author

Yes it is. I'll try and find some time to scope out how much time it would take and see whether the maintenance budget would cover it. What are your time scales?

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

No branches or pull requests

2 participants