kaushikrch / rucm

Implementation of Unobserved Components Models (UCM) in R
3 stars 3 forks source link

add tol parameter to ucm, closes issue #10 #11

Closed timvink closed 6 years ago

timvink commented 6 years ago

Add a tol parameter to ucm and bump a minor version.

I noticed that the version on CRAN is at 0.6 and here on github it's at 0.4, so I bumped the version to 0.6.1. Updated NEWS.md and README.md.

Let me know what you think.

timvink commented 6 years ago

Awesome, thanks. Just checking though, aren't we missing some code here on github. 0.5 and 0.6 were released on CRAN?

Also, I have no experience on how to publish packages to CRAN. Any plans on publishing 0.6.1?

kaushikrch commented 6 years ago

There are still some pending changes to the package with respect to optimization methods (optim function) and some error debugging. Once those are complete, would be publishing on CRAN. Thanks for the contributions though.

On Mon, Feb 5, 2018 at 4:17 PM, Tim Vink notifications@github.com wrote:

Awesome, thanks. Just checking though, aren't we missing some code here on github. 0.5 and 0.6 were released on CRAN?

Also, I have no experience on how to publish packages to CRAN. Any plans on publishing 0.6.1?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/kaushikrch/rucm/pull/11#issuecomment-363048251, or mute the thread https://github.com/notifications/unsubscribe-auth/AHNwBNH-HxmjItMFKH5SOsbxZJenP4xXks5tRtxNgaJpZM4R5HXi .

timvink commented 6 years ago

I recently joined a project for which I was also rewriting some old R code. The previous coder had also changed the KFAS::fitSSM() function to use trustOptim::trust.optim() instead of optim(). Here is the relevant bit of code, might be usefull:

  # piece of a custom KFAS::fitSSM() function
  gradient <- function(x, model, ...) {
    return(grad(likfn, x, model = model, ...))
  }
  out <- NULL
  #   out$optim.out <- optim(par = inits, fn = likfn, model = model, control = list(maxit = 2000),
  #                          ...)
  #   out$model <- updatefn(out$opt$par, model, ...)
  out$optim.out <-
    trust.optim(
      x = inits,
      fn = likfn,
      gr = gradient,
      method = "SR1", 
      model = model,
      control = list(
        report.level = 0,
        start.trust.radius = 5,
        maxit = 1000
      )
    )
  out$model <- updatefn(out$opt$solution, model, ...)