Skip to content
Permalink
Browse files

Merge pull request #51 from chapmanb/cn-estimation-nas

Check for NAs during parameter estimation
  • Loading branch information...
gavinha committed Jul 23, 2019
2 parents 2c34f41 + b881b1f commit b8cd44db26c8752ff0487106620f0b42718c3dc8
Showing with 5 additions and 4 deletions.
  1. +5 −4 R/paramEstimation.R
@@ -256,14 +256,15 @@ updateParameters <- function(n_0, s_0, var_0, varR_0, phi_0, corRho_0, chrPos_0,
var_prev <- var
varR_prev <- varR
phi_prev <- phi

if (objfun[maxFind] >= objfun[i]) {

if (is.na(objfun[maxFind]) || is.na(objfun[i])) {
} else if (objfun[maxFind] >= objfun[i]) {
#if (verbose)
#message("Coordinate descent decreases likelihood.")
} else {
} else {
maxFind <- i
}
if ((abs(objfun[i] - objfun[i - 1])/abs(objfun[i])) <= 0.001) {
if (!is.na(objfun[i]) && (abs(objfun[i] - objfun[i - 1])/abs(objfun[i])) <= 0.001) {
converged <- 1
}
}

0 comments on commit b8cd44d

Please sign in to comment.
You can’t perform that action at this time.