From 6ceb70b31d690ada802fa66b2385e35eb3fa183e Mon Sep 17 00:00:00 2001 From: Patrick Kofod Mogensen Date: Tue, 3 Oct 2023 12:24:30 +0200 Subject: [PATCH 1/3] Update curve_fit.jl to not send big floats to beta_inc_inv --- src/curve_fit.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/curve_fit.jl b/src/curve_fit.jl index 5b0c207..c6b934f 100755 --- a/src/curve_fit.jl +++ b/src/curve_fit.jl @@ -298,8 +298,8 @@ function margin_error(fit::LsqFitResult, alpha=0.05; rtol::Real=NaN, atol::Real= # atol : absolute tolerance for approximate comparisson to 0.0 in negativity check # rtol : relative tolerance for approximate comparisson to 0.0 in negativity check std_errors = stderror(fit; rtol=rtol, atol=atol) - dist = TDist(dof(fit)) - critical_values = quantile(dist, 1 - alpha / 2) + dist = TDist(Floatdof(fit)) + critical_values = eltype(coef(ft))(quantile(dist, Float64(1 - alpha / 2))) # scale standard errors by quantile of the student-t distribution (critical values) return std_errors * critical_values end From c446f101ee755a308d7e993434a1fb4331838b6c Mon Sep 17 00:00:00 2001 From: Patrick Kofod Mogensen Date: Tue, 3 Oct 2023 12:27:51 +0200 Subject: [PATCH 2/3] Update src/curve_fit.jl --- src/curve_fit.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/curve_fit.jl b/src/curve_fit.jl index c6b934f..c4a6155 100755 --- a/src/curve_fit.jl +++ b/src/curve_fit.jl @@ -298,7 +298,7 @@ function margin_error(fit::LsqFitResult, alpha=0.05; rtol::Real=NaN, atol::Real= # atol : absolute tolerance for approximate comparisson to 0.0 in negativity check # rtol : relative tolerance for approximate comparisson to 0.0 in negativity check std_errors = stderror(fit; rtol=rtol, atol=atol) - dist = TDist(Floatdof(fit)) + dist = TDist(dof(fit)) critical_values = eltype(coef(ft))(quantile(dist, Float64(1 - alpha / 2))) # scale standard errors by quantile of the student-t distribution (critical values) return std_errors * critical_values From 2c30784c6d6df8f437282569eacaa3c287771b79 Mon Sep 17 00:00:00 2001 From: Patrick Kofod Mogensen Date: Tue, 3 Oct 2023 12:30:42 +0200 Subject: [PATCH 3/3] Update src/curve_fit.jl --- src/curve_fit.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/curve_fit.jl b/src/curve_fit.jl index c4a6155..77b5378 100755 --- a/src/curve_fit.jl +++ b/src/curve_fit.jl @@ -299,7 +299,7 @@ function margin_error(fit::LsqFitResult, alpha=0.05; rtol::Real=NaN, atol::Real= # rtol : relative tolerance for approximate comparisson to 0.0 in negativity check std_errors = stderror(fit; rtol=rtol, atol=atol) dist = TDist(dof(fit)) - critical_values = eltype(coef(ft))(quantile(dist, Float64(1 - alpha / 2))) + critical_values = eltype(coef(fit))(quantile(dist, Float64(1 - alpha / 2))) # scale standard errors by quantile of the student-t distribution (critical values) return std_errors * critical_values end