#> stats graphics grDevices datasets utils methods base #> LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib #> BLAS: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.0.dylib Ppc_plot % filter(conc % filter(conc R version 4.1.2 () Geom_point(aes(y = y), data = obs_df, size = pt_size, color = STAN_RED) + ynew_mean %Īes(ymin = ynew_hdi_low, ymax = ynew_hdi_hi), The inset plot is a zoomed-in view of the posterior predictive distribution at the lower concentrations. The mean and 89% highest density intervals (HDI) are shown in blue below along with the observed data in red. I also had the model make posterior predictions on concentrations across the observed range at smaller step-sizes. Title = "Posterior predictive distribution" Scale_x_continuous(expand = expansion(c(0, 0))) + Geom_point(aes(y = y), data = dilution_standards_data, color = STAN_RED) + Geom_point(data = ppc_mean, color = "black") + Geom_line(group = "a", data = ppc_mean, color = "black") + Geom_line(aes(group = grp), alpha = 0.05, color = SNS_BLUE) + The mean of the likelihood is defined for a given concentration $x$ using the standard equation used in the field: The model uses a normal likelihood to describe the posterior distribution $p(y|x)$. Title = "Serial dilution standard curve", Scale_color_brewer(type = "qual", palette = "Set1") + Scale_y_continuous(expand = expansion(c(0, 0.02)), limits = c(0, NA)) + Scale_x_continuous(expand = expansion(c(0, 0.02)), limits = c(0, NA)) + Ggplot(aes(x = conc, y = y, color = rep)) + The following plot shows the two standard dilution curves. Options(mc.cores = parallel::detectCores()) Repository of my work for Aki Vehtari’s Bayesian Data Analysis The best I could do was copy the data for the standard curve from a table in the book and build the model to fit that data. Unfortunately, I was unable to find the original data in Gelman’s original publication of the model 2. Below, I build the model with Stan and fit it using MCMC. Serial dilution standard curve and using it to estimate unknown concentrations. In chapter 17 “Parametric nonlinear models” of Bayesian Data Analysis 1 by Gelman et al., the authors present an example of fitting a curve to a
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |