Comments (5)
Hi Greg. Thanks for this suggestion. Based on my mental model of how PyMC works, I am not convinced yet that these changes will make a difference, but I might be mistaken. Have you run a minimal example with and without this change, and are the results actually different?
from thinkbayes2.
Allen - I worked this example further and got a tip from Christian Luhmann on Discourse and my thoughts are now laid out in this notebook. I think you will be able to see what I'm thinking by scanning the visuals. I ran my analysis on a simplified model, but following the pattern, I think that this code:
with pm.Model() as model:
yeast_conc = pm.Normal("yeast conc",
mu=2 * billion, sd=0.4 * billion)
shaker1_vol = pm.Normal("shaker1 vol",
mu=9.0, sd=0.05)
shaker2_vol = pm.Normal("shaker2 vol",
mu=9.0, sd=0.05)
shaker3_vol = pm.Normal("shaker3 vol",
mu=9.0, sd=0.05)
should be:
import theano.tensor as tt
rand_stream = tt.random.utils.RandomStream()
with pm.Model() as model:
yeast_conc = pm.Normal("yeast conc",
mu=2 * billion, sd=0.4 * billion)
shaker1_vol = pm.Deterministic("shaker1 vol",
rand_stream.normal(9.0, 0.05))
shaker2_vol = pm.Deterministic("shaker2 vol",
rand_stream.normal(9.0, 0.05))
shaker3_vol = pm.Deterministic("shaker3 vol",
rand_stream.normal(9.0, 0.05))
if the intent is for the shaker volumes to be fixed distributions (i.e., regardless of the observed data). Let me know if I can help develop this idea further.
Greg
from thinkbayes2.
Hi Greg,
I think I see the distinction you are making: in the first case, the model specifies a prior distribution for shaker1_vol
(for example) and generates samples from its posterior distribution. In the second case, the distribution of shaker1_vol
is considered known and does not get updated based on the data.
If I'm interpreting that correctly, I think the first model is what I want to use. It might seem strange that the data should change our opinion about the volumes of the shakers, but it might help to think of it this way: "Before seeing the data, I knew that the actual volume in the shakers could vary. After seeing the data, I have some information about where in the range of variation the volumes happened to fall during this particular experiment." For example, in a sample where yeast_conc
is actually low, and the measurements are relatively high, I would suspect that the volumes were on the high side.
Allen
from thinkbayes2.
Yes, you see the distinction I'm trying to make! Thank you. I'll close this issue and leave my code on Discord for posterity. In my work in environmental engineering, the second model is more common (e.g., the laboratory reported the concentration is x, and their qaqc program says they are accurate to +/- s). But I can see your point and it depends on the scientist. The beauty of open science is that the assumptions are transparent!
from thinkbayes2.
All good. Thanks!
from thinkbayes2.
Related Issues (20)
- Chapter 8 missing cells in zip file HOT 3
- 'Compile' book from code HOT 1
- Chapter 10 Solutions - Definition / Implementation mismatch for the logistic HOT 1
- Chapter 6 Goblin Exercise HOT 2
- Example 6-8 number of Outperforming Portfolios HOT 2
- What is considered to be the "data" in the M&M solution? (Ch 2: Bayes's Theorem) HOT 2
- Chapter 1 download data code isn't working HOT 5
- TypeError: Series.__init__() got an unexpected keyword argument 'normalize' HOT 2
- gss_bayes.csv HOT 2
- Oliver Problem - Chapter 6 - General Question HOT 1
- Lincoln Index - Three parameter model HOT 17
- Linda problem should use conditional probability when it comes to sex. HOT 2
- Formulas Not Displaying Properly in github.io version HOT 3
- Chapter 5 Prison Sentences HOT 7
- Chapter 1: caseid definition in the gss_bayes dataset HOT 1
- Chapter 8 - unexpected overlapping curves HOT 1
- Chapter 2 - nomenclature adjustment HOT 2
- Chapter 4 - Proper Prior Probability Initialisation
- Chapter 4 - Typo in Plot Legend
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from thinkbayes2.