Menu

error in non-converging chains

runjags
Ed Merkle
2016-06-03
2016-06-22
  • Ed Merkle

    Ed Merkle - 2016-06-03

    Matt,

    I have enjoyed the runjags package and use it heavily in my "blavaan" package. I recently came across a small error in runjags 2.0.3-2 that seems to have arisen upon upgrade to R 3.3.0.

    The error occurs in the timestring() function when time2 is NA. I believe this can cause some model estimation to fail when the gelman.diag is large. (For example, if line 415 or 501 of autoextend.jags.R is triggered, we get the error "'tim' is not character or numeric".)

    Example of the error:

    time1 <- as.difftime(5, units="secs")
    runjags:::timestring(time1)

    It seems that the na.omit() line in timestring() is failing because it does not like a time object being combined with NA.

    Best,
    Ed

     
  • Matt Denwood

    Matt Denwood - 2016-06-13

    Hi Ed

    Many thanks for the bug report - I have been slow to upgrade to R 3.3.0 so had not noticed this yet myself. I have updated the timestring function to handle this scenario in a better fashion, and this update will be included in the next version of runjags.

    Thanks again,

    Matt

     
  • Alexey Shiklomanov

    Loosely related, but there's another bug in autoextend.jags.R.

    Around line 495, you currently have:

                if(is.numeric(convergence$mpsrf)){
                    mpsrfstring <- " (Unable to calculate the multi-variate psrf)"
                }else{
                    mpsrfstring <- paste(" (multi-variate psrf = ", round(convergence$mpsrf, digits=3), ")", sep="")
                }
    

    ...when in fact, it should be if(!is.numeric(...)). This causes the function to break on the round() call.

     
  • Matt Denwood

    Matt Denwood - 2016-06-22

    Thanks Alexey - this was fixed a month or so ago, but I haven't got around to submitting a new version to CRAN yet. It will be in the next update though!

    Thanks again to both of you for taking the time to report these issues!

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.