You are on page 1of 4

Using MCMC for fitting

models to data
I have used Python for developing the fitting code

Why Python?
Easy to learn and use
Vast collection of libraries for mathematical
computation
Powerful plotting libraries are also available
Language of choice for many modern scientific research

Fitting a straight line


Goal: I want to fit a straight line to a sample dataset

I need an estimate of slope and intercept

Estimate uncertainty associated with them

Dataset has 2D uncertainty in both x and y

Problem: Standard practice of Maximizing likelihood


function or weighted least square can only incorporate
y uncertainty. How to introduce x uncertainty in fitting
model as well?

Some basics of
Probability Theory
Likelihood function: Probability of getting a particular
dataset given the Model parameters ( like slope and
intercept ) and a prior knowledge ( like about x and x
uncertainty or everything else I can safely state
beforehand about the problem )
Posterior probability: Probability of getting a particular
value of Model parameters given my dataset
Prior Probability: A probability distribution of the Model
parameters hat represents all knowledge except the
data yi for all I running over entire dataset

You might also like