Running a multivariate example in emcee

20 views
Skip to first unread message

Haricash Ravi

unread,
Jul 1, 2022, 8:17:14 AM7/1/22
to emcee users
Hello All,
I am new to MCMC and emcee and am trying out an example with a multivariate model (generalised from the one given in the quickstart). My model is of the form y = ax+by+cz+d.

However, I have encountered an error that I am unable to solve. I'd love to have some help in knowing where I have gone wrong and how I can rectify it!

I have attached the code and the corresponding error message in a single file. Thanks in advance for checking it out!

Warm Regards
Arun
code.ipynb

Dan Foreman-Mackey

unread,
Jul 1, 2022, 9:10:22 AM7/1/22
to emcee...@googlegroups.com
In your code you define the "log_likelihood" as:

(f - model(params, var))/ferr)**2

but that's not right! This is a chi^2 vector, but if you want to compute a likelihood you need:

-0.5 * np.sum((f - model(params, var))/ferr)**2)

Both the -0.5 and sum are _very_ important!

Dan
--
You received this message because you are subscribed to the Google Groups "emcee users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emcee-users...@googlegroups.com.


Attachments:
  • code.ipynb

Haricash Ravi

unread,
Jul 1, 2022, 9:31:46 AM7/1/22
to emcee users
Oh :facepalm:
Thanks a lot for your help, Dan!

Arun
Reply all
Reply to author
Forward
0 new messages