Skip to content

Commit

Permalink
v0.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
PharmCat committed Nov 27, 2020
1 parent 32c9e8e commit 56097d1
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 13 deletions.
12 changes: 5 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"

[extras]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand All @@ -24,13 +23,12 @@ Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
test = ["CSV", "Test", "Plots"]

[compat]
julia = "1.0, 1.1, 1.2, 1.3, 1.4"
Distributions = "0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23"
julia = "1.0, 1.1, 1.2, 1.3, 1.4, 1.5"
Distributions = "0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24"
StatsBase = "0.22, 0.23, 0.24, 0.25, 0.26, 0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33"
QuadGK = "2.0, 2.1, 2.2, 2.3, 2.4"
SpecialFunctions = "0.8, 0.9, 0.10"
Roots = "0.7, 0.8, 1.0"
RecipesBase = "0.7, 0.8, 1.0"
SpecialFunctions = "0.8, 0.9, 0.10, 1"
Roots = "0.7, 0.8, 1"
RecipesBase = "0.7, 0.8, 1"
Reexport = "0.1, 0.2"
DataFrames = "0.19, 0.20"
CSV = "0.5, 0.6"
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
[![Coverage Status](https://coveralls.io/repos/github/PharmCat/ClinicalTrialUtilities.jl/badge.svg?branch=master)](https://coveralls.io/github/PharmCat/ClinicalTrialUtilities.jl?branch=master)
[![Latest docs](https://img.shields.io/badge/docs-latest-blue.svg)](https://pharmcat.github.io/ClinicalTrialUtilities.jl/dev/)

## Difference since v0.3.0

Wrong Equivalence Hypothesis alpha level! Use 0.2.7 or 0.3.1 version.

## 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.
Expand Down
3 changes: 2 additions & 1 deletion cange.log
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
v0.3.2
- bugfix fisher test
- add show
- propci for ConTab
- propci for ConTab
- bump dependencies

v0.3.1

Expand Down
4 changes: 4 additions & 0 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ When ctpower/ctsamplen used:
- :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;

## Invalidated version v0.3.0 (removed from release page)

Wrong Equivalence Hypothesis alpha level! Use 0.2.7, 0.3.1 version or higher.

## Contents

```@contents
Expand Down
24 changes: 23 additions & 1 deletion src/ci.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ function propci(x::Int, n::Int; alpha::Real = 0.05, method = :default)::ConfInt
throw(ArgumentError("unknown method!"))
end
end
"""
propci(tab::ConTab{2,2}; alpha::Real = 0.05, method::Symbol = :default)
Confidence interval for proportions a / (a + b) and c / (c + d)
"""
function propci(tab::ConTab{2,2}; alpha::Real = 0.05, method::Symbol = :default)
d = Dict()
d[tab.row[1]] = propci(tab.a, tab.a + tab.b; alpha = alpha, method = method)
Expand Down Expand Up @@ -192,6 +197,9 @@ function diffpropci(x1::Int, n1::Int, x2::Int, n2::Int; alpha::Real = 0.05, meth
if alpha >= 1.0 || alpha <= 0.0
throw(ArgumentError("Alpha shold be > 0.0 and < 1.0"))
end
if x1 > n1 || x2 > n2
throw(ArgumentError("X cann't be more than N"))
end
if method == :nhs
return propdiffnhsci(x1, n1, x2, n2, alpha)
elseif method == :nhscc
Expand All @@ -212,7 +220,11 @@ function diffpropci(x1::Int, n1::Int, x2::Int, n2::Int; alpha::Real = 0.05, meth
throw(ArgumentError("Method unknown!"))
end
end
#TEST
"""
diffpropci(tab::ConTab{2,2}; alpha::Real = 0.05, method::Symbol = :default)::ConfInt
Confidence interval for proportion difference: (a / (a + b)) - (c / (c + d))
"""
function diffpropci(tab::ConTab{2,2}; alpha::Real = 0.05, method::Symbol = :default)::ConfInt
diffpropci(tab.a, tab.a + tab.b, tab.c, tab.c + tab.d; alpha = alpha, method = method)
end
Expand Down Expand Up @@ -244,6 +256,11 @@ function rrpropci(x1::Int, n1::Int, x2::Int, n2::Int; alpha::Real = 0.05, method
throw(ArgumentError("Method unknown!"))
end
end
"""
rrpropci(tab::ConTab{2,2}; alpha::Real = 0.05, method::Symbol = :default)::ConfInt
Confidence interval for relative risk.
"""
function rrpropci(tab::ConTab{2,2}; alpha::Real = 0.05, method::Symbol = :default)::ConfInt
rrpropci(tab.a, tab.a + tab.b, tab.c, tab.c + tab.d; alpha = alpha, method = method)
end
Expand Down Expand Up @@ -277,6 +294,11 @@ function orpropci(x1::Int, n1::Int, x2::Int, n2::Int; alpha::Real = 0.05, method
throw(ArgumentError("Method unknown!"))
end
end
"""
orpropci(tab::ConTab{2,2}; alpha::Real = 0.05, method::Symbol = :default)::ConfInt
Confidence interval for odd ratio.
"""
function orpropci(tab::ConTab{2,2}; alpha::Real = 0.05, method::Symbol = :default)::ConfInt
orpropci(tab.a, tab.a + tab.b, tab.c, tab.c + tab.d; alpha = alpha, method = method)
end
Expand Down
9 changes: 9 additions & 0 deletions src/freque.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,16 @@ function contab(data::DataFrame, sort; row::Symbol, col::Symbol)
end
return DataSet(result)
end
"""
contab(m; row = nothing, col = nothing)
Make contingency table.
"""
function contab(m::Matrix; row = nothing, col = nothing)
if isa(row, Nothing) row = Vector{Symbol}(undef, size(m, 1)) .= Symbol("") end
if isa(col, Nothing) col = Vector{Symbol}(undef, size(m, 2)) .= Symbol("") end
ConTab(m, row, col)
end
"""
mcnmcontab
"""
Expand Down

0 comments on commit 56097d1

Please sign in to comment.