pistacliffcho / icenReg_devel

Code for icenReg plus testData
4 stars 0 forks source link

ic_sample error #4

Closed tdhock closed 5 years ago

tdhock commented 5 years ago

Hi I'm trying to use ic_sample via this code

library(icenReg)
library(penaltyLearning)
data(neuroblastomaProcessed, package="penaltyLearning")

X.mat <- neuroblastomaProcessed$feature.mat[, c("log.n", "log.hall")]
y.mat <- neuroblastomaProcessed$target.mat
fit.par <- ic_par(
  Surv(exp(min.L), exp(max.L), type="interval2") ~ log.n + log.hall,
  data.frame(X.mat, y.mat),
  model="aft",
  dist="lnorm")
ic_sample(fit.par)

and I'm getting the following error, The output I got was

> ic_sample(fit.par)
Error in if (any(p < 0)) stop("probabilities provided to getSurvTimes are less than 0") : 
  missing value where TRUE/FALSE needed
In addition: Warning message:
In runif(length(p1), p1, p2) : NAs produced
> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] icenReg_2.0.9              coda_0.19-2               
[3] Rcpp_1.0.0                 survival_2.42-3           
[5] penaltyLearning_2018.09.04 data.table_1.11.8         
[7] namedCapture_2019.02.25   

loaded via a namespace (and not attached):
 [1] pillar_1.3.0     compiler_3.5.1   plyr_1.8.4       bindr_0.1.1     
 [5] iterators_1.0.11 tools_3.5.1      magic_1.5-9      tibble_1.4.2    
 [9] gtable_0.2.0     lattice_0.20-35  pkgconfig_2.0.2  rlang_0.3.0.1   
[13] Matrix_1.2-14    foreach_1.5.1    bindrcpp_0.2.2   dplyr_0.7.8     
[17] grid_3.5.1       tidyselect_0.2.5 glue_1.3.0       R6_2.3.0        
[21] ggplot2_3.1.0    purrr_0.2.5      magrittr_1.5     scales_1.0.0    
[25] codetools_0.2-15 splines_3.5.1    assertthat_0.2.0 abind_1.4-7     
[29] colorspace_1.4-0 geometry_0.3-6   lazyeval_0.2.1   munsell_0.5.0   
[33] crayon_1.3.4    
> 

any ideas how to fix?

or is there any other way to get a distribution of predicted responses/times for a new covariate?

Thanks

pistacliffcho commented 5 years ago

Hi Toby,

Thanks for the report. Looking into things, it appears that there's a bug with dist = "lnorm". As a quick workaround, you could use dist = "gamma" instead, as they have nearly identical log-likelihoods.

I think I've figured out what the issue is and it shouldn't be too hard to patch up. I'll let you know when it's fixed.

pistacliffcho commented 5 years ago

Hi Toby,

The issue has been resolved. If you want to use dist = "lnorm", you can pull version v.2.0.10 from this repo and install icenReg locally or use devtools::install_github.

I'm not going to push to CRAN just yet, as I would like to do a little more cleaning of ic_sample, particularly to sped it up.

tdhock commented 5 years ago

great thanks!

On Fri, Apr 5, 2019 at 1:52 PM Clifford Anderson-Bergman < notifications@github.com> wrote:

Hi Toby,

The issue has been resolved. If you want to use dist = "lnorm", you can pull version v.2.0.10 from this repo and install icenReg locally or use devtools::install_github.

I'm not going to push to CRAN just yet, as I would like to do a little more cleaning of ic_sample, particularly to sped it up.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pistacliffcho/icenReg_devel/issues/4#issuecomment-480418194, or mute the thread https://github.com/notifications/unsubscribe-auth/AA478jpomG5SKzX8pjgmFa-5L2xmbwlUks5vd7d7gaJpZM4cfdw0 .

tdhock commented 5 years ago

just checked, the new version of the code does work now.