Geometric mean in NCA analysis

Hello :slight_smile:
I would like to calculate geometric mean of AUC, t1/2, Cmax etc.
Is there any way to calculate geometric mean from NCAReport results?
Thank you.

hi @jdw7262 - welcome to the community and thanks for asking the question.

Yes, we can do any sort of summary statistics on the NCAReport after converting it to a datframe (NCA.to_dataframe). We are planning to add some convenience functions to allow the standard summaries in a NCA report that are usually generated. But until then, specifically for your case, if you want to compute the geometric mean of something in julia you would have to do something like below:

using DataFrames
using Statistics

mynca = DataFrame(cmax = [2,2.3,3,3.1], auc =[10,10.4,11,11.8])
julia> describe(mynca)
2Γ—8 DataFrame
β”‚ Row β”‚ variable β”‚ mean    β”‚ min     β”‚ median  β”‚ max     β”‚ nunique β”‚ nmissing β”‚ eltype   β”‚
β”‚     β”‚ Symbol   β”‚ Float64 β”‚ Float64 β”‚ Float64 β”‚ Float64 β”‚ Nothing β”‚ Nothing  β”‚ DataType β”‚
β”œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 1   β”‚ cmax     β”‚ 2.6     β”‚ 2.0     β”‚ 2.65    β”‚ 3.1     β”‚         β”‚          β”‚ Float64  β”‚
β”‚ 2   β”‚ auc      β”‚ 10.8    β”‚ 10.0    β”‚ 10.7    β”‚ 11.8    β”‚         β”‚          β”‚ Float64  β”‚

describe is a julia function in the DataFrames package that give you many summaries of all columns in your dataset. In addition to that, you can then write any summary function and pass it into the describe function. Below, is a small function for geometric mean

function geomean(x)
    data = log.(x)
    gmean = exp(mean(data))
    gmean
end

Then, I call the function with only specific outputs as below

describe(mynca, :min, :max, :geomean => geomean)

julia> describe(mynca, :min, :max, :geomean => geomean)
2Γ—4 DataFrame
β”‚ Row β”‚ variable β”‚ min     β”‚ max     β”‚ geomean  β”‚
β”‚     β”‚ Symbol   β”‚ Float64 β”‚ Float64 β”‚ Float64  β”‚
β”œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 1   β”‚ cmax     β”‚ 2.0     β”‚ 3.1     β”‚ 0.939018 β”‚
β”‚ 2   β”‚ auc      β”‚ 10.0    β”‚ 11.8    β”‚ 2.3776   β”‚

This is a small example. We intend to add these as convenience functions that have standard NCA summaries in an upcoming release.

Hope this helps.

2 Likes

Thank you so much for your explanation. It is really helpful :slight_smile:
Have a great day!
Best Regards, Dawoon

Hi :slight_smile:
I am not sure about my concept, but β€˜geomean’ function is already existing in pkg’ StatsBase’, so a function which had the name, β€˜geomean’, couldn’t be created when I tried.
So I tried like below and it worked.

function AAA(x)
data = log.(x)
gmean = exp(mean(data))
gmean
end

Thank you.