Package 'pk4adi'

Title: PK for Anesthetic Depth Indicators
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".
Authors: Feng Jiang [aut, cre], Hua Li [ctb], Mengge Zhang [ctb], Wanlin Chen [ctb], Warren D Smith [ctb], Robert C Dutton [ctb], Ty N Smith [ctb]
Maintainer: Feng Jiang <[email protected]>
License: MIT + file LICENSE
Version: 0.1.3
Built: 2025-02-06 02:39:22 UTC
Source: https://github.com/xfz329/rpk4adi

Help Index


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)