Skip to content

Commit

Permalink
Merge pull request #3 from xfz329/develop
Browse files Browse the repository at this point in the history
0.1.3
  • Loading branch information
xfz329 authored Jul 13, 2023
2 parents 98c7581 + c0652fa commit f5aec04
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 49 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Change logs
## 0.1.3
Minor update.
* Docs update.
## 0.1.2
Major update.
* The first R-implementation version of pk4adi.
Expand Down
23 changes: 17 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
Package: pk4adi
Type: Package
Title: PK for Anesthetic Depth Indicators
Version: 0.1.2
Author: Jiang Feng
Maintainer: xfz329 <[email protected]>
Description: Calculate and compare the Anesthetic Depth Indicators PK values in R
The package's name pk4adi is short for "PK for Anesthetic Depth Indicators".
The prediction probability (PK) was first proposed by Dr. Warren D. Smith in the paper Measuring the Performance of Anesthetic Depth Indicators.
Version: 0.1.3
Authors@R: c(
person("Feng","Jiang", role=c("aut","cre"), email="[email protected]"),
person("Hua","Li", role="ctb"),
person("Mengge","Zhang", role="ctb"),
person("Wanlin","Chen", role="ctb"),
person("Warren D","Smith", role="ctb"),
person("Robert C","Dutton", role="ctb"),
person("Ty N","Smith", role="ctb"))
Maintainer: Feng Jiang <[email protected]>
Description: Calculate and compare the Anesthetic Depth Indicators PK values in R language
The prediction probability (PK) is a widely used tool for the anesthetic depth indicators,
which was first proposed by Dr. Warren D. Smith in the paper
Warren D. Smith; Robert C. Dutton; Ty N. Smith (1996) <doi:10.1097/00000542-199601000-00005> and
Warren D. Smith; Robert C. Dutton; Ty N. Smith (1996) <doi:10.1002/(SICI)1097-0258(19960615)15:11<1199::AID-SIM218>3.0.CO;2-Y>.
They provide the Micro xls files to calculate and compare the PK values.
This package provide the easy-to-use API to calculate and compare the PK values using the R language.
The package's name, pk4adi, is short for "PK for Anesthetic Depth Indicators".
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Expand Down
23 changes: 2 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,2 @@
MIT License

Copyright (c) 2023 xfz329

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
YEAR: 2023
COPYRIGHT HOLDER: Zhejiang University
16 changes: 10 additions & 6 deletions R/calculate_pk.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
#' @title Compute the pk value to Measure the Performance of Anesthetic Depth Indicators.
#' @title Compute the PK value to Measure the Performance of Anesthetic Depth Indicators.
#'
#' @param x_in a vector, the indicator.
#' @param y_in a vector, the state.
#'
#' @return a list containing all the matrices and variables during the calculation.
#' The value list$type is "PK", which indicated the list is return-value of the function calculate_pk().
#' The value list$type is "PK", which indicated the list is the return-value of the function calculate_pk().
#' The type of list$basic is also a list, which contains the most important results of the function.
#' The type of list$matrices is also a list, which contains all the matrices during the calculation.
#' The type of list$details is also a list, which contains all the intermediate variables during the calculation.
#'
#' @references Warren D. Smith, Robert C. Dutton, Ty N. Smith; Measuring the Performance of Anesthetic Depth Indicators. Anesthesiology 1996; 84:38–51 doi: https://doi.org/10.1097/00000542-199601000-00005.
#' @references Warren D. Smith, Robert C. Dutton, Ty N. Smith; Measuring the Performance of Anesthetic Depth Indicators.
#' Anesthesiology 1996; 84:38–51 doi: https://doi.org/10.1097/00000542-199601000-00005.
#' @references Warren D. Smith, Robert C. Dutton, Ty N. Smith; A measure of association for assessing prediction accuracy
#' that is a generalization of nonparametric ROC area. Statistics in Medicine 1996; 15: 1119-1215
#' doi: https://doi.org/10.1002/(SICI)1097-0258(19960615)15:11<1199::AID-SIM218>3.0.CO;2-Y.
#'
#' @import data.table
#'
Expand All @@ -18,17 +22,17 @@
#' @examples
#' x1 <- c(0, 0, 0, 0, 0, 0)
#' y1 <- c(1, 1, 1, 1, 1, 2)
#' ans <- calculate_pk(x1, y1)
#' ans1 <- calculate_pk(x1, y1)
#'
#' ## show the most important results.
#' print(ans$basic)
#' print(ans1$basic)
#'
#' x2 <- c(1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6)
#' y2 <- c(1, 1, 1, 1, 1, 2, 1, 1, 3, 3, 2, 2, 2, 2, 2, 1, 3, 3, 3, 3, 3, 3, 3, 3)
#' ans2 <- calculate_pk(x2, y2)
#'
#' ## show the full results.
#' print(ans)
#' print(ans2)
calculate_pk <- function(x_in, y_in) {
x <- x_in
y <- y_in
Expand Down
10 changes: 7 additions & 3 deletions R/compare_pks.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' @title Compare two answers of the pk values.
#' @title Compare two answers of the PK values.
#'
#' @description Both of the two input have to be the output of the function calculate_pk().
#'
Expand All @@ -7,12 +7,16 @@
#' @param pk2 a list, the output of the function calculate_pk().
#'
#' @return a list containing all the variables during the calculation.
#' The value list$type is "PKC", which indicated the list is return-value of the function compare_pk().
#' The value list$type is "PKC", which indicated the list is the return-value of the function compare_pk().
#' The type of list$group is also a list, which contains the normal distribution test results for the group variables.
#' The type of list$pair is also a list, which contains the t distribution test results for the pair variables.
#' The type of list$details is also a list, which contains all the intermediate variables during the calculation.
#'
#' @references Warren D. Smith, Robert C. Dutton, Ty N. Smith; Measuring the Performance of Anesthetic Depth Indicators. Anesthesiology 1996; 84:38–51 doi: https://doi.org/10.1097/00000542-199601000-00005.
#' @references Warren D. Smith, Robert C. Dutton, Ty N. Smith; Measuring the Performance of Anesthetic Depth Indicators.
#' Anesthesiology 1996; 84:38–51 doi: https://doi.org/10.1097/00000542-199601000-00005.
#' @references Warren D. Smith, Robert C. Dutton, Ty N. Smith; A measure of association for assessing prediction accuracy
#' that is a generalization of nonparametric ROC area. Statistics in Medicine 1996; 15: 1119-1215
#' doi: https://doi.org/10.1002/(SICI)1097-0258(19960615)15:11<1199::AID-SIM218>3.0.CO;2-Y.
#'
#' @importFrom stats pnorm
#' @importFrom stats pt
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,17 @@ The best way to use this package is to use R scripts.
```r
x1 <- c(0, 0, 0, 0, 0, 0)
y1 <- c(1, 1, 1, 1, 1, 2)
ans <- calculate_pk(x1, y1)
ans1 <- calculate_pk(x1, y1)

## show the most important results.
print(ans$basic)
print(ans1$basic)

x2 <- c(1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6)
y2 <- c(1, 1, 1, 1, 1, 2, 1, 1, 3, 3, 2, 2, 2, 2, 2, 1, 3, 3, 3, 3, 3, 3, 3, 3)
ans2 <- calculate_pk(x2, y2)

## show the full results.
print(ans)
print(ans2$basic)
```
You will get the following output.
```r
Expand Down
19 changes: 12 additions & 7 deletions man/calculate_pk.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions man/compare_pks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f5aec04

Please sign in to comment.