Skip to content

allow user to specify the minimum sampling variance as a percentage of the prior variance #61

@carolyner

Description

@carolyner

The code in imabc.R, copied below, checks that the sampling variance does not drop below a minimum value, currently hard coded to be 10% of the prior variance (i.e. 0.01 in lines 1031, 1035, and 1037. Revising this to be an option (e.g., 0=no minimum up to 1, which would not allow any narrowing) will increase user flexibility and improve documentation. Suggest a default of 10%.

      # Deal with parameters that don't have any variance
      if (any(diag(sample_cov) <= 0.1*prior_sds^2)) {
        # This occurs when adding a new parameter: it is set to default for all prior draws
        # it may also occur when sampling becomes over concentrated around center points
        message("Potentially over-concentrated sampling: Parameters with sampling variance < 10% of prior variance")
        is_small <- (diag(sample_cov)<= 0.1*prior_sds^2)
        sample_sd <- sqrt(diag(sample_cov))
        sd_next <- sqrt(0.1)*prior_sds


        # limit variance to become no more than 10% of prior variance while retaining correlation structure
        sample_sd[is_small] <- sd_next[is_small]
        sample_cov <- increase_samplevar(var_data,sample_sd)
        }

Note that this code also refers to a new function, increase_samplevar() which may need some clean-up.

Finally, please improve the message above, to provide information about the triggering parameter and the corresponding variance (3 sig digits).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions