View source: R/update_functions_ramses.R
Function that performs a M-H update for a named parameter given the RAMSES structural elements and loglikelihood/logprior functions. Candidate values are drawn from a normal distribution, but it does allow for upper and lower bounds.
1 2 3 | update_metropolis(current_value, candidate_value, loglik_func,
logprior_func, parm_state, fixed, tune = 0.01, lower = NULL,
upper = NULL)
|
current_value |
current value of the parameter. |
candidate_value |
optional; specifies the candidate or proposed value. If left out, a random normal vector is generated as the proposal. |
loglik_func, logprior_func |
log likelihood/prior function that takes the current value, parm_state, and fixed. It is possible to let the current value be simply extracted from parm_state. |
parm_state |
list that names parameters and contains current values. |
fixed |
list of named values that remain fixed in the model. |
tune |
tuning parameter (standard deviation) in the normal proposal distribution. |
lower, upper |
bounds for the parameter to restrict proposed values for univariate parameters. Invalid values are reflected back into the domain. If both bounds are provided, make sure the tune is small so that reflections won't also be invalid. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.