Sample a standard normal in log-space and apply the error to observations.

sample_lognormal(obs, sd)

Arguments

obs

A vector of observed values you wish to sample with log-normal error.

sd

A vector of standard deviations to use in stats::rnorm().

Details

Newly sampled values are calculated \(obs*exp(stats::rnorm(1, 0, sd)-sd^2/2)\). The second term adjusts the random samples so that their expected value is obs, i.e., the log-normal bias correction.

Author

Cole Monnahan