Data Fitting and Model Calibration
EasyModelAnalysis.datafit
— Functiondatafit(prob, p, t, data)
datafit(prob, p, data)
Fit parameters p
to data
measured at times t
.
Arguments
prob
: ODEProblemp
: Vector of pairs of symbolic parameters and initial guesses for the parameters.t
: Vector of time-pointsdata
: Vector of pairs of symbolic states and measurements of these states at timest
.
Keyword Arguments
- `loss`: the loss function used for fitting. Defaults to `EasyModelAnalysis.l2loss`,
with an alternative being `EasyModelAnalysis.relative_l2loss` for relative weighted error.
p
does not have to contain all the parameters required to solve prob
, it can be a subset of parameters. Other parameters necessary to solve prob
default to the parameter values found in prob.p
. Similarly, not all states must be measured.
Data Definition
The data definition is given as a vctor of pairs. If t
is specified globally for the datafit, then those time series correspond to the time points specified. For example,
[x => [11.352378507900013, 11.818374125301172, -10.72999081810307]
z => [2.005502877055581, 13.626953144513832, 5.382984515620634, 12.232084518374545]]
then if datafit(prob, p, t, data)
, t
must be length 3 and these values correspond to x(t[i])
.
If datafit(prob, p, data)
, then the data must be a tuple of (t, timeseries), for example:
[x => ([1.0, 2.0, 3.0], [11.352378507900013, 11.818374125301172, -10.72999081810307])
z => ([0.5, 1.5, 2.5, 3.5],
[2.005502877055581, 13.626953144513832, 5.382984515620634, 12.232084518374545])]
where this means x(2.0) == 11.81...
EasyModelAnalysis.global_datafit
— Functionglobal_datafit(prob, pbounds, t, data; maxiters = 10000)
global_datafit(prob, pbounds, data; maxiters = 10000)
Fit parameters p
to data
measured at times t
.
Arguments
prob
: ODEProblempbounds
: Vector of pairs of symbolic parameters to vectors of lower and upper bounds for the parameters.t
: Vector of time-pointsdata
: Vector of pairs of symbolic states and measurements of these states at timest
.
Keyword Arguments
maxiters
: how long to run the optimization for. Defaults to 10000. Larger values are slower but more robust.loss
: the loss function used for fitting. Defaults toEasyModelAnalysis.l2loss
, with an alternative beingEasyModelAnalysis.relative_l2loss
for relative weighted error.
p
does not have to contain all the parameters required to solve prob
, it can be a subset of parameters. Other parameters necessary to solve prob
default to the parameter values found in prob.p
. Similarly, not all states must be measured.
Data Definition
The data definition is given as a vctor of pairs. If t
is specified globally for the datafit, then those time series correspond to the time points specified. For example,
[x => [11.352378507900013, 11.818374125301172, -10.72999081810307]
z => [2.005502877055581, 13.626953144513832, 5.382984515620634, 12.232084518374545]]
then if datafit(prob, p, t, data)
, t
must be length 3 and these values correspond to x(t[i])
.
If datafit(prob, p, data)
, then the data must be a tuple of (t, timeseries), for example:
[x => ([1.0, 2.0, 3.0], [11.352378507900013, 11.818374125301172, -10.72999081810307])
z => ([0.5, 1.5, 2.5, 3.5],
[2.005502877055581, 13.626953144513832, 5.382984515620634, 12.232084518374545])]
where this means x(2.0) == 11.81...
EasyModelAnalysis.bayesian_datafit
— Functionbayesian_datafit(prob, p, t, data)
bayesian_datafit(prob, p, data)
Calculate posterior distribution for parameters p
given data
measured at times t
.
Data Definition
The data definition is given as a vctor of pairs. If t
is specified globally for the datafit, then those time series correspond to the time points specified. For example,
[x => [11.352378507900013, 11.818374125301172, -10.72999081810307]
z => [2.005502877055581, 13.626953144513832, 5.382984515620634, 12.232084518374545]]
then if datafit(prob, p, t, data)
, t
must be length 3 and these values correspond to x(t[i])
.
If datafit(prob, p, data)
, then the data must be a tuple of (t, timeseries), for example:
[x => ([1.0, 2.0, 3.0], [11.352378507900013, 11.818374125301172, -10.72999081810307])
z => ([0.5, 1.5, 2.5, 3.5],
[2.005502877055581, 13.626953144513832, 5.382984515620634, 12.232084518374545])]
where this means x(2.0) == 11.81...