diff --git a/CHANGELOG.md b/CHANGELOG.md index cf5cc1a..f8cdc83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/DESCRIPTION b/DESCRIPTION index 97e15ee..b3b6626 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,13 +1,24 @@ Package: pk4adi Type: Package Title: PK for Anesthetic Depth Indicators -Version: 0.1.2 -Author: Jiang Feng -Maintainer: xfz329 -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="silencejiang@zju.edu.cn"), + 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 +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) and + Warren D. Smith; Robert C. Dutton; Ty N. Smith (1996) 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 diff --git a/LICENSE b/LICENSE index 7ed2785..7fbd37e 100644 --- a/LICENSE +++ b/LICENSE @@ -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 \ No newline at end of file diff --git a/R/calculate_pk.R b/R/calculate_pk.R index 09b74cb..c76d10c 100644 --- a/R/calculate_pk.R +++ b/R/calculate_pk.R @@ -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 #' @@ -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 diff --git a/R/compare_pks.R b/R/compare_pks.R index 64342fc..05877ef 100644 --- a/R/compare_pks.R +++ b/R/compare_pks.R @@ -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(). #' @@ -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 diff --git a/README.md b/README.md index d534c66..24323d9 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/man/calculate_pk.Rd b/man/calculate_pk.Rd index cef8b45..49f4e43 100644 --- a/man/calculate_pk.Rd +++ b/man/calculate_pk.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/calculate_pk.R \name{calculate_pk} \alias{calculate_pk} -\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.} \usage{ calculate_pk(x_in, y_in) } @@ -13,29 +13,34 @@ calculate_pk(x_in, y_in) } \value{ 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. } \description{ -Compute the pk value to Measure the Performance of Anesthetic Depth Indicators. +Compute the PK value to Measure the Performance of Anesthetic Depth Indicators. } \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) } \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. +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. + +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. } diff --git a/man/compare_pks.Rd b/man/compare_pks.Rd index 92fca7b..c7d29f7 100644 --- a/man/compare_pks.Rd +++ b/man/compare_pks.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/compare_pks.R \name{compare_pks} \alias{compare_pks} -\title{Compare two answers of the pk values.} +\title{Compare two answers of the PK values.} \usage{ compare_pks(pk1, pk2) } @@ -13,7 +13,7 @@ compare_pks(pk1, pk2) } \value{ 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. @@ -39,5 +39,10 @@ print(ans$group) print(ans$pair) } \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. +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. + +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. }