Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
FitRoutines
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Antonino D'Anna
FitRoutines
Commits
c8556db3
Commit
c8556db3
authored
Apr 28, 2026
by
Antonino D'Anna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced GammaMethod.cov_AD with ADerrors.cov_sym
parent
68e25eac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
src/fit_functions.jl
src/fit_functions.jl
+9
-6
src/pvalue.jl
src/pvalue.jl
+4
-2
No files found.
src/fit_functions.jl
View file @
c8556db3
...
...
@@ -88,7 +88,7 @@ function fit_routine(model::Function,
[
uwerr
(
y
,
wpm
)
for
y
in
ydata
]
if
length
(
W
)
==
0
if
corr
C
=
length
(
C
)
==
0
?
GammaMethod
.
cov_AD
(
ydata
)
:
C
C
=
length
(
C
)
==
0
?
ADerrors
.
cov_sym
(
ydata
)
:
C
W
=
LinearAlgebra
.
pinv
(
C
);
W
=
(
W
'
+
W
)
*
0.5
else
...
...
@@ -102,11 +102,14 @@ function fit_routine(model::Function,
chi2
=
sum
(
fit
.
resid
.^
2
)
par
=
fit_error
(
chisq
,
LsqFit
.
coef
(
fit
),
ydata
,
wpm
,
W
,
false
)
# if the fit is correlated we have already C, no need to recompute it.
chiexp
,
pval
=
if
length
(
C
)
!=
0
GammaMethod
.
chiexp
(
chisq
,
LsqFit
.
coef
(
fit
),
value
.
(
ydata
),
C
,
W
),
pvalue
(
chisq
,
chi2
,
LsqFit
.
coef
(
fit
),
ydata
,
W
,
C
=
C
)
else
ADerrors
.
chiexp
(
chisq
,
LsqFit
.
coef
(
fit
),
ydata
,
wpm
,
W
=
W
),
pvalue
(
chisq
,
chi2
,
LsqFit
.
coef
(
fit
),
ydata
,
W
,
wpm
=
wpm
)
end
chiexp
=
ADerrors
.
chiexp
(
chisq
,
LsqFit
.
coef
(
fit
),
ydata
,
wpm
,
C
=
length
(
C
)
==
0
?
nothing
:
C
,
W
=
W
)
pval
=
pvalue
(
chisq
,
chi2
,
LsqFit
.
coef
(
fit
),
ydata
,
W
,
wpm
=
wpm
,
C
=
C
)
compute_error_for_logging
(
logfile
,
par
);
println
(
logfile
,
"fit_routine output:"
)
...
...
src/pvalue.jl
View file @
c8556db3
...
...
@@ -35,7 +35,7 @@ end
W::Union{Vector{Float64},Array{Float64,2}} = Vector{Float64}();
wpm = Dict{Int64,Vector{Float64}}()
nmc::Int64 = 5000,
C::AbstractMatrix{Float64} =
GammaMethod.cov_AD(data,wpm
))
C::AbstractMatrix{Float64} =
Matrix{Float64}(undef,0,0
))
Computes the p-value of a previously done fit, using as input the `\chi^2` observed from the fit, the fit parameters and the fitted data.
The p-value for a given `\chi^2` is the probability of, given the data you have, finding such a `\chi^2` or worse from a fit, and still
...
...
@@ -67,7 +67,7 @@ function pvalue(chisq::Function,
W
::
AbstractVector
{
Float64
}
=
Vector
{
Float64
}();
wpm
::
Union
{
Dict
{
Int64
,
Vector
{
Float64
}},
Dict
{
String
,
Vector
{
Float64
}},
Nothing
}
=
Dict
{
Int64
,
Vector
{
Float64
}}(),
nmc
::
Int64
=
5000
,
C
::
AbstractMatrix
{
Float64
}
=
ADerrors
.
cov
(
data
,
wpm
))
C
::
AbstractMatrix
{
Float64
}
=
Matrix
{
Float64
}(
undef
,
0
,
0
))
n
=
length
(
xp
)
# Number of fit parameters
m
=
length
(
data
)
# Number of data
...
...
@@ -128,6 +128,8 @@ function pvalue(chisq::Function,
_Px
end
length
(
C
)
!=
0
||
(
C
=
ADerrors
.
cov_sym
(
data
))
nu
=
let
aux
=
sqrt
(
C
)
aux2
=
similar
(
aux
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment