Commit 2015cdb7 authored by ale's avatar ale

fit_alg supports W and wpm now

parent 619245f8
......@@ -1540,7 +1540,8 @@ function fit_alg(f::Function, x::Union{Vector{Int64}, Vector{Float64}, Matrix{Fl
end
function fit_alg(model::Function,x::Array{Float64},y::Array{uwreal},param::Int64,W::Matrix{Float64};
guess::Union{Float64, Vector{Float64}, Nothing}=nothing)
guess::Union{Float64, Vector{Float64}, Nothing}=nothing,
wpm::Union{Dict{Int64,Vector{Float64}},Dict{String,Vector{Float64}}, Nothing}=nothing)
if guess == nothing
p00 = [.5 for i in 1:param]
......@@ -1552,7 +1553,7 @@ function fit_alg(model::Function,x::Array{Float64},y::Array{uwreal},param::Int64
chisq_corr(par,dat) = juobs.gen_chisq_correlated(model, x, W, par, dat)
fit = curve_fit(model,x,value.(y),W,p00)
up, chi_exp = fit_error(chisq_corr, coef(fit), y, W=W)
up, chi_exp = fit_error(chisq_corr, coef(fit), y, wpm, W=W)
uwerr.(up)
chi2 = sum(fit.resid .^ 2)
pval = pvalue(chisq_corr, sum(fit.resid .^ 2), value.(up), y, W)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment