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

add cubic spline option #4

Open
k-doering-NOAA opened this issue Dec 8, 2021 · 6 comments
Open

add cubic spline option #4

k-doering-NOAA opened this issue Dec 8, 2021 · 6 comments
Assignees

Comments

@k-doering-NOAA
Copy link
Contributor

Thanks @iantaylor-NOAA for contributing this idea. cubic spline selectivity functionality would be really helpful (discussed in r4ss/r4ss#63 as well as r4ss/r4ss#48.

@k-doering-NOAA
Copy link
Contributor Author

I think the definitions for the admb functions are here: http://api.admb-project.org/vcubicspline_8cpp_source.html

I'm curious how they differ from spline interpolations in r, like stats::spline. If they are similar (or even kind of similar) perhaps we could just rely on the R functionality instead of needing to use admb.

@k-doering-NOAA
Copy link
Contributor Author

@iantaylor-NOAA , do you have any r code that mimics the cubic spline selectivity? We basically just need a function that reads in the params as input and outputs the selectivity patterns to use in the GUI (and hopefully, this need not rely on admb...)

@k-doering-NOAA
Copy link
Contributor Author

Also, any selectivity functions could be safely added here: https://github.com/r4ss/shiny_selex/blob/main/selex_fxns.R. They will not mess up the Shiny app.

@iantaylor-NOAA
Copy link
Contributor

Thanks for moving this idea forward, @k-doering-NOAA.
When I first worked on setting up a widget for cubic spline selectivity long ago, I was not able to replicate (or even fully understand) the ADMB implementation of the spline function and thus just relied on an ADMB executable to do the calculations.

However, I believe that @roliveros-ramos was able to get a good match as part of his work on empirical selectivity with IATTC (which we really need to finish integrating into r4ss).

@k-doering-NOAA, one of us could compare the results of code here to the results of an Stock Synthesis model with splines:
https://github.com/roliveros-ramos/r4ss.selectivity/blob/master/R/selectivity_pattern-27-splines.R.

@k-doering-NOAA
Copy link
Contributor Author

Another potential resource is the spline function Neal uses in the GUI: https://github.com/nmfs-stock-synthesis/ssi/blob/master/src/ttk_spline.h

@k-doering-NOAA
Copy link
Contributor Author

Finally, the actual admb function to get the spline selectivity values is: http://api.admb-project.org/cspline_8cpp_source.html#l00037

(vcubic_spline_function eventually passes to this function)

@k-doering-NOAA k-doering-NOAA removed their assignment Jul 20, 2022
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

2 participants