This function takes the summary statistics of the estimated posterior distribution of a parameter and simulates random values from a normal distribution with its mean and standard deviation. If CI_low and CI_high are supplied, simulated values are truncated by the confidence bounds.
sim_param(n, mean, sd, CI_low = NULL, CI_high = NULL)
n | number of simulations |
---|---|
mean | mean of parameter posterior distribution |
sd | standard of parameter posterior distribution |
CI_low | lower confidence bound of estimated posterior (default = NULL) |
CI_high | upper confidence bound of estimated posterior (default = NULL) |
a vector of length n
Other simulation:
sim_gravity()
,
sim_mobility()
,
sim_prob_travel()
M <- mobility_matrices$M D <- mobility_matrices$D N <- mobility_matrices$N mod <- summarize_mobility( fit_gravity(M, D, N) )#>#>#> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 74 #> Unobserved stochastic nodes: 30 #> Total graph size: 1196 #> #> Initializing model #> #> NOTE: Stopping adaptation #> #>param <- 'gamma' sim_param(n=10, mean=mod[param,'Mean'], sd=mod[param,'SD'], CI_low=mod[param,'HPD2.5'], CI_high=mod[param,'HPD97.5'])#> [1] 1.723452 1.718868 1.722950 1.734572 1.717050 1.722614 1.731236 1.746726 #> [9] 1.743070 1.743962