How could I establish a posterior for the data when we can fit more than two times model to the data?

24 views
Skip to first unread message

Zahra Sheikh

unread,
May 26, 2014, 12:29:02 PM5/26/14
to py...@googlegroups.com
I am googling to find some example for pyMC in the case that we have a model and observation and we want to fit more than one time the model to data and find free parameters of data. I couldn't find anything appropriate that can inspire me to write my own code except the common example of pyMC especially if the Gaussian distribution could be a good example of likelihhood. I also need to know how I could define a prior for pymc given by P(log (c))=1/(sigma sqrt(2*pi))exp(-0.5/sigma^2(log (c)- <og (c)>)^2).

Thanks a lot.

John Salvatier

unread,
May 27, 2014, 1:06:04 PM5/27/14
to py...@googlegroups.com
I'm not sure what exactly you mean for for your first question. You can call `sample` more than once if that's what you mean. 

For your second question, you can create your own distribution pretty easily. Look at the Normal distribution as an example (https://github.com/pymc-devs/pymc/blob/master/pymc/distributions/continuous.py#L77). The `logp` function defines the log probability density and is the only other required method besides __init__


On Mon, May 26, 2014 at 9:29 AM, Zahra Sheikh <sheikh...@gmail.com> wrote:
I am googling to find some example for pyMC in the case that we have a model and observation and we want to fit more than one time the model to data and find free parameters of data. I couldn't find anything appropriate that can inspire me to write my own code except the common example of pyMC especially if the Gaussian distribution could be a good example of likelihhood. I also need to know how I could define a prior for pymc given by P(log (c))=1/(sigma sqrt(2*pi))exp(-0.5/sigma^2(log (c)- <og (c)>)^2).

Thanks a lot.

--
You received this message because you are subscribed to the Google Groups "PyMC" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pymc+uns...@googlegroups.com.
To post to this group, send email to py...@googlegroups.com.
Visit this group at http://groups.google.com/group/pymc.
For more options, visit https://groups.google.com/d/optout.

Zahra Sheikh

unread,
May 28, 2014, 3:31:53 PM5/28/14
to py...@googlegroups.com
I have posted my questions with more details in stack exchange (http://stats.stackexchange.com/questions/99587/how-do-we-define-log-normal-prior-and-a-multivariate-posterior-log-likelihood-in) but nobody replied so far, and I am getting frustrated. I have written a piece of code in order to generate the distribution for prior, especially for 'c' parameter with log-normal distribution. I will appreciate if you check whether I have coded it in a right way or not?

I have another question, the defined chi-squared that I mentioned in my question in stack exchange, I have tested with other methods and there are like four peaks and I don't know how I should structure my chi-square for MCMC in other to find all the peaks? could you give me a simple example or some tips?

Thanks in advance
Reply all
Reply to author
Forward
0 new messages