Skip to content

Commit

Permalink
Merge pull request #51 from chapmanb/cn-estimation-nas
Browse files Browse the repository at this point in the history
Check for NAs during parameter estimation
  • Loading branch information
gavinha authored Jul 23, 2019
2 parents 2c34f41 + b881b1f commit b8cd44d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions R/paramEstimation.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit b8cd44d

Please sign in to comment.