Skip to content

Commit

Permalink
statutils
Browse files Browse the repository at this point in the history
  • Loading branch information
PharmCat committed Aug 8, 2021
1 parent aa64e3f commit 16c48d9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MetidaBase"
uuid = "075456b7-4006-432f-9324-2f8453996c49"
authors = ["PharmCat <[email protected]> and contributors"]
version = "0.3.1"
version = "0.3.2"

[deps]
#StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Expand Down
2 changes: 1 addition & 1 deletion src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ end
function subset(d::DataSet, sort::Dict)
inds = findall(x-> sort x.id, d.ds)
if length(inds) > 0 return DataSet(d.ds[inds]) end
nothing
[]
end
################################################################################
# metida_table from DataSet{AbstractIDResult}
Expand Down
39 changes: 39 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,42 @@ end

isnanormissing(x::Number) = isnan(x)
isnanormissing(x::Missing) = true


# STATISTICS


#CV2se
"""
sdfromcv(cv::Real)::AbstractFloat
LnSD from CV.
"""
function sdfromcv(cv)
return sqrt(varfromcv(cv))
end
"""
varfromcv(cv::Real)::AbstractFloat
LnVariance from CV.
"""
function varfromcv(cv)
return log(1+cv^2)
end
"""
cvfromvar(σ²::Real)::AbstractFloat
CV from variance.
"""
function cvfromvar(σ²)
return sqrt(exp(σ²)-1)
end
#CV2se
"""
cvfromsd(σ::Real)::AbstractFloat
CV from variance.
"""
function cvfromsd(σ)
return sqrt(exp^2)-1)
end

0 comments on commit 16c48d9

Please sign in to comment.