Skip to content

Bug appears when doing two-dimensional maximization #1

Description

@Stan125

Hi @alexanderlange53 and @kaihusmann,

I found a bug that appears when doing two-dimensional log-likelihood maximisation:

library("optimization")
#> Loading required package: Rcpp
library("gamlss.dist")
#> Loading required package: MASS
y <- rWARING(100)
ll <- function(par, y) {
  mu <- par[1]
  sigma <- par[2]
  if (mu <= 0 | sigma <= 0)
    return(NA)
  l_i <- dWARING(x = y, mu = mu, sigma = sigma, log = TRUE)
  s_li <- sum(l_i)
  return(s_li)
}
ll_no_y <- function(par) {
  return(ll(par, y = y))
}
optimization::optim_nm(fun = ll_no_y, k = 2, start = c(0.5, 0.5),
                       trace = TRUE, maximum = TRUE)
#> Error in if (Ry > simplex[k, 1]) {: missing value where TRUE/FALSE needed

and wanted to let you guys know. If I find the time I'll look into it myself!

Best,
Stani

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions