Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Unit-specific random walk standard deviations #53

Open
jeswheel opened this issue Aug 16, 2024 · 1 comment
Open

Unit-specific random walk standard deviations #53

jeswheel opened this issue Aug 16, 2024 · 1 comment

Comments

@jeswheel
Copy link
Collaborator

A potentially nice feature that could be added is functionality that facilitates unit-specific random walk standard deviations. It currently appears possible because the mif2 function can accepts lists as inputs to rw.sd, however this is hardly convenient. For instance, I think one could specify:

mif2(
   ..., 
   rw.sd = list(
      rw_sd(tau = 0.02, kappa = 0.02), 
      rw_sd(tau = 0.02, kappa = 0.02), 
      rw_sd(tau = 0.01, kappa = 0.02, beta = 0.01)
  )

In this example, the random walk standard deviation is 0.02 for all parameters and units except for unit 3, which has specific standard deviations for tau and beta. While this is possible, it can be tedious if there are many units and a user would like additional control. More frequently, we just specify a single call to rw_sd and the mif2.internal function will convert it to a list on our behalf (if it isn't already a list).

It would be nice to have the option of doing something like this instead:

mif2(
   ..., 
   rw.sd = rw_sd(tau = 0.02, kappa = 0.02, `tau[unit3]` = 0.01, `beta[unit3]` = 0.01)
)

This would give the same rw-sd specification as before: if a parameter is mentioned without a corresponding unit, then this parameter becomes the value of all unit-specific parameters that share the same name. However, this can be over-written by being more explicit.

This change would likely be implemented in R/mif2.R, in the mif2.internal function. In the 5th line of code in this function, it takes the input rw.sd and turns it into a list (if it isn't already one), just replicating things. Prior to this line of code, some logic can be implemented that would check if there are any unit-specific parameters present (indicated by the brackets). It may not be too difficult to implement this, but I haven't had this need yet so I'm leaving this suggestion as an issue to work on later.

@kingaa
Copy link
Collaborator

kingaa commented Aug 17, 2024

Seems workable....

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants