Type: Package
Title: PK for Anesthetic Depth Indicators
Version: 0.1.3.2
Maintainer: Feng Jiang <silencejiang@zju.edu.cn>
Description: Calculate and compare the prediction probability (PK) values for Anesthetic Depth Indicators. The PK values are widely used for measuring the performance of anesthetic depth and were first proposed by the group of 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%3C1199::AID-SIM218%3E3.0.CO;2-Y>. The authors provided two 'Microsoft Excel' files in xls format for calculating and comparing PK values. This package provides an easy-to-use API for calculating and comparing PK values in R.
License: MIT + file LICENSE
Encoding: UTF-8
URL: https://www.r-project.org, https://github.com/xfz329/rpk4adi
BugReports: https://github.com/xfz329/rpk4adi/issues
RoxygenNote: 7.2.3
Imports: data.table (≥ 1.10), stats
NeedsCompilation: no
Packaged: 2023-07-15 12:32:12 UTC; Silence
Author: Feng Jiang [aut, cre], Hua Li [ctb], Mengge Zhang [ctb], Wanlin Chen [ctb], Hang Chen [ths], Xinzhong Chen [ths], Warren D Smith [ctb], Robert C Dutton [ctb], Ty N Smith [ctb], Zhejiang University [cph, fnd]
Repository: CRAN
Date/Publication: 2023-07-16 17:20:02 UTC

Compute the PK value to Measure the Performance of Anesthetic Depth Indicators.

Description

Compute the PK value to Measure the Performance of Anesthetic Depth Indicators.

Usage

calculate_pk(x_in, y_in)

Arguments

x_in

a vector, the indicator.

y_in

a vector, the state.

Value

a list containing all the matrices and variables during the calculation. 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.

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.

Examples

x1 <- c(0, 0, 0, 0, 0, 0)
y1 <- c(1, 1, 1, 1, 1, 2)
ans1 <- calculate_pk(x1, y1)

## show the most important results.
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(ans2)

Compare two answers of the PK values.

Description

Both of the two input have to be the output of the function calculate_pk().

Usage

compare_pks(pk1, pk2)

Arguments

pk1

a list, the output of the function calculate_pk().

pk2

a list, the output of the function calculate_pk().

Value

a list containing all the variables during the calculation. 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.

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.

Examples

x1 <- 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)
y1 <- 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)

pk1 <- calculate_pk(x_in = x1, y_in = y1)
print(pk1$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, 2, 1, 1, 2, 1, 2, 3, 3, 2, 2, 1, 2, 2, 2, 3, 3, 3, 3, 2, 3, 3, 2)

pk2 <- calculate_pk(x_in = x2, y_in = y2)
print(pk2$basic)

ans <- compare_pks(pk1, pk2)
print(ans$group)
print(ans$pair)