- `vp[3]`: The autocorrelation function ``\Gamma(t)`` is summed up a point where its error ``\delta\Gamma(t)`` is a factor `vp[3]` times larger than the signal.
function get_chi(model::Function,x::Vector,par,data,W::Vector{Float64})
returnsum((data.-model(x,par)).^2.*W)
end
An additional fourth parameter `vp[4]`, tells ADerrors to add a tail to the error with ``\tau_{exp} = wpm[4]``.
@docraw"""
Negative values of `wpm[1:4]` are ignored and only one component of `wpm[1:3]` needs to be positive.
- `wpm`: Windows parameter that ADerrors uses to computes the errors. This is used both when computing the error of the data and when computing the covariance matrix through `ADerrors.cov`
```
- `corr::Bool`: if `true` (default) it exectues the correlated fit, this flag is overridden if `W` is passed as a `Vector`. When `corr=true`, and `W` is not given, it computes the covarinace matrix through `ADerrors.cov`, then it is inverted and symmetrized.
- `W::VecOrMat{Float64}`: Weight matrix/vector. When given, the flag `corr` is overridden. If `W` is a `Vector` the fit is perfomed uncorrelated,otherwise is correlated.
- `guess::Vector{Float64}`: Initial guess used in the fit routine.
- `logfile`: handle to a logfile. If `nothing`, no log will be written. It can be `IO` file or a custom log structure that has an overloading for `print()` and `println()`.
# Returns
It returns a NamedTuple with names:
- `:par`: fit parameter as `Vector{uwreal}`
- `:chi2`: chisquare,
- `:chiexp`: chisquare expected
- `:pval`: pvalue
"""
"""
function fit_routine(model::Function,xdata::Array{<:Real},ydata::Array{uwreal},param::Int64=3;info::Bool=false,wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}},Nothing}=nothing,
println(logfile,"Fit routine in [$(xdata[1]),...,$(xdata[2])]")
println(logifle,"parameters :",par...)
println(logfile,"chi2: ",chi2)
println(logfile,"chiexp: ",chiexp)
println(logfile,"pvalue: ",pval)
end
return(par=par,chi2=chi2,chiexp=chiexp,pval=pval)
end
end
function fit_routine(model::Vector{Function},xdata::Vector{Array{Float64,N}}whereN,ydata::Vector{Array{uwreal,N}}whereN,param::Int64;wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}},Nothing}=nothing,
function fit_routine(model::Vector{Function},xdata::Vector{Array{Float64,N}}whereN,ydata::Vector{Array{uwreal,N}}whereN,param::Int64;wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}},Nothing}=nothing,