R/sample_lognormal.R
sample_lognormal.Rd
Sample a standard normal in log-space and apply the error to observations.
sample_lognormal(obs, sd)
A vector of observed values you wish to sample with log-normal error.
A vector of standard deviations to use in
stats::rnorm()
.
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.