Apply Bayesian statistical methods to real-world problems including parameter estimation, hypothesis testing, and decision-making under uncertainty.
You are a statistician applying Bayesian methods to a practical analysis problem. Based on the following context, create a comprehensive Bayesian analysis framework. Analysis Problem: [DESCRIBE THE QUESTION - e.g., estimating conversion rate, comparing treatments, forecasting demand] Data Available: [DESCRIBE YOUR OBSERVED DATA] Prior Knowledge: [WHAT DO YOU ALREADY KNOW OR BELIEVE ABOUT THE PARAMETERS] Decision Context: [WHAT DECISION WILL THIS ANALYSIS INFORM] Audience: [TECHNICAL STATISTICIANS/DATA SCIENTISTS/BUSINESS STAKEHOLDERS] Tools: [PYMC/STAN/BRMS/TURING - OR FLEXIBLE] Build the Bayesian analysis across these six sections: 1. PROBLEM FORMULATION AND MODEL SPECIFICATION Translate the business question into a Bayesian model specification. Define the likelihood function that describes how the observed data was generated given the model parameters. Specify the parameters to estimate and their interpretations in business terms. Write out the full probabilistic model using mathematical notation and explain each component. Compare the Bayesian approach to the frequentist alternative for this specific problem, highlighting what the Bayesian approach adds such as incorporating prior knowledge, producing full posterior distributions rather than point estimates, and enabling probabilistic statements about parameters. Provide the model specification in PyMC code with clear documentation. 2. PRIOR SELECTION AND SENSITIVITY ANALYSIS Select appropriate priors for each parameter and justify the choices. Cover uninformative priors for when genuine prior knowledge is lacking, weakly informative priors that regularize without dominating the data, and informative priors based on domain expertise or historical data. Implement prior predictive checking by simulating data from the prior to verify that the implied data distribution is reasonable before seeing the actual data. Conduct a prior sensitivity analysis by fitting the model with multiple prior specifications and comparing the posterior distributions to determine how much the prior influences the results. Provide code for visualizing prior distributions and prior predictive simulations. 3. POSTERIOR INFERENCE AND MCMC DIAGNOSTICS Fit the model using Markov Chain Monte Carlo sampling and verify the results are reliable. Implement the model in PyMC using the NUTS sampler with appropriate tuning. Check convergence using trace plots, R-hat statistics which should be below 1.01 for all parameters, and effective sample size which should be at least 400 per chain. Diagnose sampling issues including divergent transitions, low BFMI, and high tree depth. Provide strategies for addressing convergence problems including reparameterization, stronger priors, and non-centered parameterizations for hierarchical models. Visualize the posterior distributions using forest plots, pair plots showing parameter correlations, and posterior predictive checks comparing simulated data to observed data. 4. POSTERIOR SUMMARIZATION AND INTERPRETATION Summarize the posterior in ways that answer the original business question. Report posterior means, medians, and credible intervals with proper interpretation emphasizing that a 95 percent credible interval has a 95 percent probability of containing the true parameter unlike frequentist confidence intervals. Compute derived quantities of interest from the posterior such as the probability that treatment A is better than treatment B, the expected revenue under different scenarios, or the probability that a parameter exceeds a meaningful threshold. Create visualizations that communicate uncertainty effectively to the target audience including ridgeline plots for group comparisons and posterior predictive intervals for forecasts. 5. MODEL COMPARISON AND EXPANSION Compare alternative models to find the best explanation for the data. Implement model comparison using WAIC, LOO-CV, and Bayes factors. Cover the interpretation of each comparison method and when each is most appropriate. Build progressively complex models starting from simple to see how added complexity improves or overfits. Implement hierarchical and multilevel models for grouped data where parameters are partially pooled across groups. Show how to build mixture models for data with latent subpopulations. Provide a model building workflow that iterates between specifying the model, checking prior predictions, fitting, diagnosing, and evaluating. 6. DECISION ANALYSIS AND REPORTING Connect the Bayesian analysis to decision-making under uncertainty. Implement a Bayesian decision analysis framework that combines the posterior distribution with a utility or loss function to identify the optimal action. For A/B testing applications, compute the expected loss of choosing each variant and recommend the variant with the lowest expected loss. For forecasting applications, generate prediction intervals that account for both parameter uncertainty and data variability. Create a Bayesian analysis report template suitable for the target audience including clear problem statement, model description with intuitive explanations, key posterior findings with visualizations, sensitivity analysis results, and decision recommendations with quantified uncertainty.
Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[DESCRIBE YOUR OBSERVED DATA][WHAT DO YOU ALREADY KNOW OR BELIEVE ABOUT THE PARAMETERS][WHAT DECISION WILL THIS ANALYSIS INFORM]