Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizing fitSSM function to incorporate Trust Region Optimization using package trustOptim #5

Open
RajarshiBhadra opened this issue May 2, 2016 · 0 comments

Comments

@RajarshiBhadra
Copy link

RajarshiBhadra commented May 2, 2016

Currently the fitSSM module uses optim package for minimizing the likelihood function. For expanding the capability of rucm to incorporate Trust Region Optimization while minimizing the likelihood function in the fitSSM , the code can be modified using packages trustOptim (For trust Region Optimization) and numDeriv (For gradient calculations) in the following way:

Current

fitSSM <- 
function (model, inits, updatefn, checkfn, update_args = NULL, 
    ...)
{ .............
out$optim.out <- optim(par = inits, fn = likfn, model = model, 
        ...)
out$model <- do.call(updatefn, args = c(list(out$optim.out$par, 
        model), update_args))
...............
}

Proposed Customization

fitSSM_cus <- 
function (model, inits, updatefn, checkfn, update_args = NULL, 
    ...)
{ .............
gradient <- function(x,model,...){
    return(numDeriv::grad(likfn,x,model=model,...))
  }
out <- NULL
out$optim.out <- trustOptim::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 <- do.call(updatefn, args = c(list(out$optim.out$solution, 
        model), update_args))
.................
}
@RajarshiBhadra RajarshiBhadra changed the title Customizing fitSSM function so as to incorporate Trust Region Optimization using package trustOptim Customizing fitSSM function to incorporate Trust Region Optimization using package trustOptim May 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant