ClinicalTrialUtilities.jl

Clinical Trial related calculation: descriptive statistics, power and sample size calculation, power simulations, confidence interval, pharmacokinetics / pharmacodynamics parameters calculation.
Author PharmCat
Popularity
4 Stars
Updated Last
4 Months Ago
Started In
January 2019

ClinicalTrialUtilities

Clinical trial related calculation: descriptive statistics, power and sample size calculation, power simulations, confidence interval, pharmacokinetics/pharmacodynamics parameters calculation. This program comes with absolutely no warranty. No liability is accepted for any loss and risk to public health resulting from use of this software.

Build Status Build status codecov Coverage Status Latest docs

Description

The package is designed to perform calculations related to the planning and analysis of the results of clinical trials. The package includes the basic functions described below, as well as a few modules to perform specific calculations.

Installation

using Pkg; Pkg.add("ClinicalTrialUtilities");

Main features

  • Clinical trial sample size calculation
  • Power calculation
  • Confidence Interval calculation
  • NCA Pharmacokinetics parameters calculation
  • Descriptive statistics and frequencies
  • Randomization

Examples

SampleSize

NB! Hypothesis types:

  • :ea - Equality: two-sided;
  • :ei - Equivalencens: two one-sided hypothesis;
  • :ns - Non-Inferiority / Superiority: one-sided hypothesis, for some cases you should use two-sided hypothesis for Non-Inferiority/Superiority, you can use alpha/2 for this;
#Sample size for one proportion equality
ctsamplen(param=:prop, type=:ea, group=:one, a=0.3, b=0.5)

#Equivalence for two means
ctsamplen(param=:mean, type=:ei, group=:two, diff=0.3, sd=1, a=0.3, b=0.5)

#Odd ratio non-inferiority
ctsamplen(param=:or, type=:ns, diff=-0.1, a=0.3, b=0.5, k=2)

#Odd ratio equality
ctsamplen(param=:or, type=:ea, a=0.3, b=0.5, k=2)

Bioequivalence sample size

besamplen(alpha=0.05,  theta1=0.8, theta2=1.25, theta0=0.95, cv=0.15, method=:owenq)
besamplen(cv=0.20, method=:nct)
besamplen(cv=0.347, design=:parallel)
besamplen(cv=0.40)
besamplen(cv=0.347, design=:d2x2x4, method=:nct)

Power

ctpower(param=:mean, type=:ea, group=:one, a=1.5, b=2, sd=1,n=32, alpha=0.05)

Bioequivalence power

#2x2 design, default method - OwensQ
bepower(alpha=0.05, logscale=true, theta1=0.8, theta2=1.25, theta0=0.95, cv=0.2, n=20, design=:d2x2, method=:owenq)

#Same
bepower(alpha=0.05, cv=0.2, n=20, design=:d2x2)

#Bioequivalence power for cv 14%, 21 subjects, default OwensQ method, logscale false
bepower(alpha=0.1, logscale=false, theta1=-0.1, theta2=0.1, theta0=0, cv=0.14, n=21)

#Bioequivalence power for cv 14%, 21 subjects, shifted method, logscale false
bepower(alpha=0.1, logscale=false, theta1=-0.1, theta2=0.1, theta0=0, cv=0.14, n=21, method=:shifted)

#Simple notations
bepower(cv=0.4, n=35, design=:d2x4x4)
bepower(cv=0.14, n=21)

Bioequivalence CV from CI

cvfromci(;alpha = 0.05, theta1 = 0.9, theta2 = 1.25, n=30, design=:d2x2x4)

Polled CV

data = DataFrame(cv = Float64[], df = Int[])
push!(data, (0.12, 12))
push!(data, (0.2, 20))
push!(data, (0.25, 30))
pooledcv(data; cv=:cv, df=:df, alpha=0.05, returncv=true)


pooledcv([0.12, 0.2, 0.25], [14, 22, 32], [:d2x2, :d2x2, :d2x2])

Confidence Intervals

using  ClinicalTrialUtilities
ci = propci(38, 100, alpha=0.05, method=:cp)

ci = orpropci(30, 100, 40, 90; alpha=0.05, method=:mn)

ci = diffpropci(30, 100, 40, 90; alpha=0.05, method=:wald)

ci = meanci(30, 10, 30, alpha = 0.05, method=:norm)

NCA

using CSV, DataFrames, ClinicalTrialUtilities
pkdatapath = joinpath(dirname(pathof(ClinicalTrialUtilities)))*"\\..\\test\\csv\\pkdata2.csv"
pkdata  = CSV.File(pkdatapath) |> DataFrame
pkds    = pkimport(pkdata, [:Subject, :Formulation]; time = :Time, conc = :Concentration)
pk      = nca!(pkds)
ncadf   = DataFrame(pk; unst = true)
ds      = ClinicalTrialUtilities.descriptive(ncadf, stats = [:n, :mean, :sd], sort = [:Formulation])
dsdf    = ClinicalTrialUtilities.DataFrame(ds; unst = true)

Randomization

using DataFrames, ClinicalTrialUtilities
rt = ClinicalTrialUtilities.randomtable(;blocksize = 4, subject = 32, group = 2, ratio = [1,1], grseq = ["TR", "RT"], seed = 36434654652452)

Copyrights

Clinical Trial Utilities

Copyright © 2019 Vladimir Arnautov aka PharmCat (mail@pharmcat.net)

If you want to check and get R code for power/sample size estimation, you can find examples here: http://powerandsamplesize.com/Calculators/

Used By Packages

No packages found.