-
Notifications
You must be signed in to change notification settings - Fork 0
/
atomic.jl
56 lines (45 loc) · 1.49 KB
/
atomic.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""
cmax(time::AbstractVector, obs::AbstractVector)
Return Cmax
"""
function cmax(time::AbstractVector, obs::AbstractVector)
length(time) == length(obs) || error("length(time) != length(obs)")
cmax, tmax, tmaxn = ctmax(time, obs)
cmax
end
"""
tmax(time::AbstractVector, obs::AbstractVector)
Return Tmax
"""
function tmax(time::AbstractVector, obs::AbstractVector)
length(time) == length(obs) || error("length(time) != length(obs)")
cmax, tmax, tmaxn = ctmax(time, obs)
tmax
end
"""
auc(time::AbstractVector, obs::AbstractVector; calcm = :lint)
Return AUC. All concentration points included in calculation.
* `calcm` - AUC/AUMC calculation method:
- `:lint` - linear trapezoidal;
- `:logt` - log-trapezoidal after Tmax;
- `:luld` - linar up log down;
- `:luldt` - linear up log down after Tmax;
!!! note
This function doesn't contain `NaN`, `missing` or dosing time checks.
"""
function auc(time::AbstractVector, obs::AbstractVector; calcm = :lint)
length(time) == length(obs) || error("length(time) != length(obs)")
length(time) >= 2 || error("length(time) >= 2")
auc_ = 0.0
if calcm == :lint
@inbounds for i = 1:(length(time) - 1)
auc_ += linauc(time[i], time[i + 1], obs[i], obs[i+1])
end
else
cmax, tmax, tmaxn = ctmax(time, obs)
@inbounds for i = 1:(length(time) - 1)
auc_ += aucpart(time[i], time[i + 1], obs[i], obs[i + 1], calcm, i >= tmaxn)
end
end
auc_
end