title: Pooling Survreg Results Across Multiply Imputed Datasets - Error Message: log(1 - 2 * pnorm(width/2)) : NaNs produced
body: <p>I am trying to run an interval regression using the survival r package (as described here <a href="https://stats.oarc.ucla.edu/r/dae/interval-regression/" rel="nofollow noreferrer">https://stats.oarc.ucla.edu/r/dae/interval-regression/</a>), but I am running into difficulties when trying to pool results across multiply imputed datasets. Specifically, although estimates are returned, I get the following error: log(1 - 2 * pnorm(width/2)) : NaNs produced. The estimates seem reasonable, at face value (no NaNs, very large or small SEs).</p>
  <p>I ran the same model on the stacked dataset (ignoring imputations) and on individual imputed datasets, but in either case, I do not get the error. Would someone be able to explain to me what is going on? Is this an ignorable error? If not, is there a workaround that avoids this error?</p>
  <p>Thanks so much!</p>
  <pre><code># A Reproducible Example
  
  require(survival)
  require(mice)
  require(car)
  
  # Create DF
  dat &lt;- data.frame(dv = c(1, 1, 2, 1, 0, NA, 1, 4, NA, 0, 3, 1, 3, 0, 2, 1, 4, NA, 2, 4),
                    catvar1 = factor(c(0, 0, 0, 0, 0, 1, 0, 0, 0, NA, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0)),
                    catvar2 = factor(c(1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, NA, 0)))
  
  dat_imp &lt;- mice(data = dat)
  
  # Transform Outcome Var for Interval Reg
  dat_imp_long &lt;- complete(dat_imp, action = &quot;long&quot;, include=TRUE)
  
  # 1-4 correspond to ranges (e.g., 1 = 1 to 2 times...4 = 10 or more)
  # create variables that reflect this range
  dat_imp_long$dv_low &lt;- car::recode(dat_imp_long$dv, &quot;0 = 0; 1 = 1; 2 = 3; 3 = 6; 4 = 10&quot;)
  dat_imp_long$dv_high &lt;- car::recode(dat_imp_long$dv, &quot;0 = 0; 1 = 2; 2 = 5; 3 = 9; 4 = 999&quot;)
  dat_imp_long$dv_high[dat_imp_long$dv_high &gt; 40] &lt;- Inf
  
  # Convert back to mids
  dat_mids &lt;- as.mids(dat_imp_long)
  
  # Run Interval Reg 
  model1 &lt;- with(dat_mids, survreg(Surv(dv_low, dv_high, type = &quot;interval2&quot;) ~ 
                                       catvar1 + catvar2, dist = &quot;gaussian&quot;))
  
  # Warning message for both calls: In log(1 - 2 * pnorm(width/2)) : NaNs produced
  # Problem does not only occur with pool, but summary
  summary(model1)
  summary(pool(model1))
  
  # Run Equivalent Model on Individual Datasets
  # No errors produced
  imp1 &lt;- subset(dat_imp_long, .imp == 1)
  model2 &lt;- survreg(Surv(dv_low, dv_high, type = &quot;interval2&quot;) ~ 
                         catvar1 + catvar2, dist = &quot;gaussian&quot;, data = imp1)
  summary(model2)
  
  imp2 &lt;- subset(dat_imp_long, .imp == 2)
  model3 &lt;- survreg(Surv(dv_low, dv_high, type = &quot;interval2&quot;) ~ 
                      catvar1 + catvar2, dist = &quot;gaussian&quot;, data = imp2)
  summary(model3)
  
  # Equivalent Analysis on Stacked Dataset
  # No error
  model &lt;- with(dat_imp_long, survreg(Surv(dv_low, dv_high, type = &quot;interval2&quot;) ~ 
                                    catvar1 + catvar2, dist = &quot;gaussian&quot;))
  summary(model)
  </code></pre>