# Evaluated To Non-Numerical Values Error using MCMC package Mathematica Via NIntegrate

I'm using this package https://github.com/joshburkart/mathematica-mcmc and am trying to evaluate the following:

  MCMC[(5 Log[ 1.015 NIntegrate[1.3636363636363636*^26/Sqrt[
a + b (1 + z)], {z, 0, 0.015}]])/ Log, {{a, .7, .01, Real}, {b, 0, .01, Real}}, 2]


and I get The integrand 1.36364*10^26/Sqrt[a+b (1+z)] has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,0.015}}. >>

In the end it does spit out a value for the parameters a and b. However because of that error message I'm not so confident that those are the right values. Can anyone tell how I can fix MCMC package so this error doesn't come up anymore when I have NIntegrate in my likelihood?

If you define a numerical arguments function for the NIntegrate expression inside MCMC[...] then no messages are given:

In:= Import["https://raw.githubusercontent.com/joshburkart/\
mathematica-mcmc/master/mcmc.m"]

In:= F[a_?NumberQ, b_?NumberQ] :=
NIntegrate[
1.3636363636363636*^26/Sqrt[a + b (1 + z)], {z, 0, 0.015}];

In:= MCMC[(5 Log[1.015 F[a, b]])/
Log, {{a, .7, .01, Real}, {b, 0, .01, Real}}, 2]

Out= "MCMCResult"[{a -> 0.701463,
b -> 0.000967457}, "\[LeftSkeleton]2\[RightSkeleton]"]
`
• Thank you very much Anton. I greatly appreciate this help. Much thanks again :) – Daniel Berkowitz May 13 '17 at 18:17
• @DanielBerkowitz No problem, good luck. – Anton Antonov May 13 '17 at 19:41