Computes bayesian average of data. For a given fit function, it explores choices of fit intervals, assigning each a weight. Then it does the weighted average and assigns a systematic. See https://arxiv.org/abs/2008.01069
Computes bayesian average of data. For a given fit function, it explores choices of fit intervals, assigning each a weight. Then it does the weighted average and assigns a systematic. See https://arxiv.org/abs/2008.01069
The function takes as input the fit intervals to explore.
The function takes as input the fit intervals to explore.
`tmin_array` is an array of integers with the lower bounds on the fit intervals to explore, ***ordered from lower to higher***.
`tmin_array` is an array of integers with the lower bounds on the fit intervals to explore, ***ordered from lower to higher***.
`tmax_array` is an array of integers with the upper bounds on the fit intervals to explore, ***ordered from lower to higher***.
`tmax_array` is an array of integers with the upper bounds on the fit intervals to explore, ***ordered from lower to higher***.
`k` is the number of parameters of the fit function to use.
`k` is the number of parameters of the fit function to use.
You can also use as input two fit functions, and two values of `k`, one for each function.
The method returns two objects: first, the weighted average as an uwreal object, with mean value and statistichal error. The second object returned is the systematic error coming from the fit interval variation.
The method returns two objects: first, the weighted average as an uwreal object, with mean value and statistichal error. The second object returned is the systematic error coming from the fit interval variation.
function bayesian_av(fun::Function,y::Array{uwreal},tmin_array::Array{Int64},tmax_array::Array{Int64},k::Int64;wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}},Nothing}=nothing)
function bayesian_av(fun::Function,y::Array{uwreal},tmin_array::Array{Int64},tmax_array::Array{Int64},k::Int64;wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}},Nothing}=nothing)
...
@@ -374,6 +385,68 @@ function bayesian_av(fun::Function, y::Array{uwreal}, tmin_array::Array{Int64},
...
@@ -374,6 +385,68 @@ function bayesian_av(fun::Function, y::Array{uwreal}, tmin_array::Array{Int64},
end
end
function bayesian_av(fun1::Function,fun2::Function,y::Array{uwreal},tmin_array::Array{Int64},tmax_array::Array{Int64},k1::Int64,k2::Int64;wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}},Nothing}=nothing)
weight_model=Array{Float64,1}()
AIC=Array{Float64,1}()
chi2chi2exp=Array{Float64,1}()
p1=Array{uwreal,1}()
iftmax_array[end]>length(y)
error("Error: upper bound for the fits is bigger than last data point")