joshburkart / mathematica-mcmc

Mathematica Markov chain Monte Carlo
34 stars 18 forks source link

convolution in the mcmc mathematica procedure #2

Open nrnapolita opened 6 years ago

nrnapolita commented 6 years ago

I'm trying to adapt the script to best fit the model function convolved with a kernel before computing the chi2. Being not a very expert I'm having trouble to implement this. I was wondering to include my convolution line (basically the interpolation of a ParallelTable with a Numerical integral in) after having defined the modfunc in the GetChisqExpr and use a new function modfunc2 to obtain the modpoints and the Chisq.

modfunc2 should look like

modfunc2:=Interpolation[ParallelTable[{x, -2.5Log[10.,AAf/(AAf + AAf2)1./sigpsf0^2.Exp[-x^2./(2.sigpsf0^2.)]NIntegrate[yExp[-y^2./(2.sigpsf0^2.)]BesselI[0., xy/sigpsf0^2.],{y,0.,100.},WorkingPrecision -> 10., MaxRecursion -> 10., Method -> {Automatic,"SymbolicProcessing"->0.}] + AAf2/(AAf + AAf2)1./sigpsf02^2.Exp[-x^2./(2.sigpsf02^2.)]NIntegrate[yExp[-y^2./(2.sigpsf02^2.)]BesselI[0., x*y/sigpsf02^2.], {y,0.,100.}, WorkingPrecision -> 10., MaxRecursion -> 10., Method -> {Automatic,"SymbolicProcessing"->0.}]]}, {x, 0.1, 30., 0.3}],InterpolationOrder ->1.];

with all parameters expept x and y variables being assigned in the same module as numerical values.

joshburkart commented 6 years ago

Happy to try to help, but I can't really understand what you're asking... What's a modfunc? I see there's a variable called modfunc in the code, but it's not part of the public API so I'm not sure why you would be interacting with it...?

Maybe if you could input a well-formatted code snippet where you're attempting to call the MCMC routine, I could take a look... Right now it's all on one line and very difficult for me to read...