pistacliffcho / icenReg_devel

Code for icenReg plus testData
4 stars 0 forks source link

Handling of NAs #1

Closed pistacliffcho closed 7 years ago

pistacliffcho commented 7 years ago

NA's, used to imply right censored responses, can be processes incorrectly if response is provided by Surv().

Example:

 > library(icenReg)
 > simData <- simIC_weib(n = 5000)
 > simData2 <- simData
 > simData2$u[simData$u == Inf] <- NA
 > 
 > correctFit <- ic_par(cbind(l,u) ~ x1 + x2, data = simData)
 > correctFit2 <- ic_par(Surv(l,u, type = 'interval2') ~ x1 +x2, data = simData)
 > correctFit3 <- ic_par(Surv(l,u, type = 'interval2') ~ x1 + x2, data = simData2)
 > badFit <- ic_par(cbind(l,u) ~ x1 + x2, data = simData2)
 > 
 > coef(correctFit)
  log_shape  log_scale         x1         x2 
  0.6588143  0.6835264  0.5486076 -0.4944020 
 > coef(correctFit2)
  log_shape  log_scale         x1         x2 
  0.6588143  0.6835264  0.5486076 -0.4944020 
 > coef(correctFit3)
  log_shape  log_scale         x1         x2 
  0.6588143  0.6835264  0.5486076 -0.4944020 
 > coef(badFit)
 log_shape  log_scale         x1         x2 
 0.7787590  0.3591405  0.3255513 -0.3357471