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

[feature:] do we need a get_parameter_names function? #666

Open
Andrea-Havron-NOAA opened this issue Aug 29, 2024 · 0 comments
Open

[feature:] do we need a get_parameter_names function? #666

Andrea-Havron-NOAA opened this issue Aug 29, 2024 · 0 comments
Labels
kind: feature New feature or request status: triage_needed This is not approved for this milestone, do not work on it yet

Comments

@Andrea-Havron-NOAA
Copy link
Collaborator

Describe the situation that led to the request and a solution

Recent changes to dev have added a get_parameter_names function to FIMS.

  • rcpp_interface.hpp, lines 84-93, detail the function that is exposed to R
  • information.hpp, lines 160-167, contain the RegisterParameterName function
  • rcpp_selectivity.hpp, line 102 provides an example on how to set up the parameter name in the interface.

I have used this code for debugging in two ways:

  1. Check the dimension of the parameters before calling MakeADFun
sucess <- CreateTMBModel()
parameters <- list(p = get_fixed())
#returns the parameter list with parameter names
get_parameter_names(parameters)
obj <- MakeADFun(data = list(), parameters, DLL = "FIMS", silent = TRUE)
  1. Look at sdreport TMB output to determine which parameters have NA standard errors
sucess <- CreateTMBModel()
parameters <- list(p = get_fixed())
#returns the parameter list with parameter names
get_parameter_names(parameters)
obj <- MakeADFun(data = list(), parameters, DLL = "FIMS", silent = TRUE)
opt <- nlminb(obj$par, obj$fn, obj$gr,
  control = list(eval.max = 800, iter.max = 800)
#Return the fitted list of parameters with parameter names
pars_named <- get_parameter_names(opt$par)
sdr <- TMB::sdreport(obj)
sdr_fixed <- summary(sdr, "fixed")
rownames(sdr_fixed) <- names(pars_named)
sdr_fixed

**Note get_parameter_names function isn't currently exposed to the user in dev.

Alternative solutions

This function may duplicate functionality available through the JSON output. @msupernaw and @rklasky, can you comment on the usability of this function, could it be helpful for power users in the future and for debugging?

Statistical validity

No response

Additional context

No response

@Andrea-Havron-NOAA Andrea-Havron-NOAA added kind: feature New feature or request status: triage_needed This is not approved for this milestone, do not work on it yet labels Aug 29, 2024
Andrea-Havron-NOAA added a commit that referenced this issue Oct 11, 2024
* issue [feature:] do we need a get_parameter_names function? #666
* add example to fims demo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: feature New feature or request status: triage_needed This is not approved for this milestone, do not work on it yet
Projects
None yet
Development

No branches or pull requests

1 participant