saudiwin / ordbetareg_pack

Repository for R package ordbetareg, used to fit continuous data with lower and upper bounds.
Other
17 stars 3 forks source link

Added init argument w/ alias inits to ordbetareg() #6

Closed bgall closed 2 years ago

bgall commented 2 years ago

The brm() argument inits is a deprecated alias of its init argument that produces a warning when ordbetareg() is called. This is annoying and it's best to avoid deprecated arguments. This pull request aims to fix this, although you'll need to additionally update the documentation accordingly with roxygen or whatever you use for it.

While both the warning and reliance on a deprecated argument are resolvable by passing values from the ordbetareg() argument inits to the init argument of brms functions, this would create confusing inconsistency in the names of arguments across brms and ordbetareg. Changing the ordbetareg() argument from inits to init also could break previous code fitting models with ordbetareg(). This PR aims to not break previous code while eliminating the warning/reliance on deprecated argument inits of brm().

I do this by renaming the inits argument for ordbetareg() to init (preserving its default value of "0") and creating a new argument inits that is NULL by default. If inits is not NULL (because the user passed it an object), the changes assign those values to init. This ensures that previous code passing values to inits still works. I then pass the init object to the brm() init argument. This eliminates the error message while ensuring the default/primary argument for initializing values within ordbetareg() has the same name as the primary, non-deprecated brm() argument.