Type: Package
Title: Hemodynamic Calculations from Clinical Monitoring
Version: 0.6.0
Description: Every research team have their own script for calculation of hemodynamic indexes. This package makes it possible to insert a long-format dataframe, and add both periods of interest (trigger-periods), and delete artifacts with deleter-files.
License: MIT + file LICENSE
URL: https://github.com/lilleoel/clinmon
BugReports: https://github.com/lilleoel/clinmon/issues
Depends: R (≥ 3.5.0)
Encoding: UTF-8
Language: en-US
LazyData: true
RoxygenNote: 7.1.1
Suggests: knitr, rmarkdown
Imports: signal (≥ 0.7-6)
NeedsCompilation: no
Packaged: 2021-02-02 13:39:52 UTC; MOLS0212
Author: Markus Harboe Olsen [cre, aut], Christian Riberholt [aut], Ronan Berg [aut], Kirsten Moeller [aut]
Maintainer: Markus Harboe Olsen <oel@oelfam.com>
Repository: CRAN
Date/Publication: 2021-02-04 11:50:02 UTC

Transfer function analysis of dynamic cerebral autoregulation (TFA)

Description

TFA() calculates dynamic cerebral autoregulation trough a transfer function analysis from a continuous recording. This function follows the recommendations from Claassen et al. [1] and mimicks the matlab script created by David Simpsons in 2015 (Matlab TFA function). TFA() also includes the possibility to analyse raw recordings with application of cyclic (beat-to-beat) average with the possiblity of utilizing interpolation. (see details).

Usage

TFA(df, variables,
trigger = NULL, deleter = NULL,
freq = 1000, fast = 50, raw_data = FALSE,
interpolation = 3, output = "table",
vlf = c(0.02,0.07),lf = c(0.07,0.2),
hf = c(0.2,0.5), detrend = FALSE,
spectral_smoothing = 3,
coherence2_thresholds = cbind(c(3:15),
c(0.51,0.40,0.34,0.29,0.25,0.22,0.20,0.18,
0.17,0.15,0.14,0.13,0.12)),
apply_coherence2_threshold = TRUE,
remove_negative_phase = TRUE,
remove_negative_phase_f_cutoff = 0.1,
normalize_ABP = FALSE,
normalize_CBFV = FALSE,
window_type = 'hanning',
window_length = 102.4,
overlap = 59.99,
overlap_adjust = TRUE,
na_as_mean = TRUE)

Arguments

df

Raw continuous recording with numeric data and first column has to be time in seconds. (dataframe)

variables

Definition of the type and order of recorded variables as a list. Middle cerebral artery blood velocity ('mcav') and arterial blood pressure ('abp') is currently supported. (list)

trigger

Trigger with two columns: first is start, and second is end of period to be analyzed. Every row is a period for analysis. Default is NULL, which results in analysis of the full dataframe. (dataframe)

deleter

Deleter with two columns: first is start and second is end of period with artefacts, which need to be deleted. Every row is a period with artefacts. Default is NULL. (dataframe)

freq

Frequency of recorded data, in Hz. Default is 1000. (numeric)

fast

Select if you want the data to aggregated resulting in a faster, but perhaps more imprecise run, in Hz. Default is 50 (numeric)

raw_data

Select TRUE if the data is raw and cyclic mean should be calculated. NB: this function have not been validated, why validated methods for calculating cyclic mean are preferred. Default is FALSE (boolian)

interpolation

Select the number of beats which should be interpolated. Default is up to 3 beats and 0 results in no interpolation. (numeric)

output

Select what the output should be. 'table' results in a dataframe with values for the three frequencies defined by Claassen et al. [1]; 'long' results in a dataframe with the results in a long format; 'plot' results in a daframe which can help plot gain, phase and coherence; 'plot-peak' results in a dataframe, which can be used to validate the cyclic average, and 'raw' results in a nested list with results primarily for debugging. Default is 'table'. (string)

vlf, lf, hf, detrend, spectral_smoothing, coherence2_thresholds, apply_coherence2_threshold, remove_negative_phase, remove_negative_phase_f_cutoff, normalize_ABP, normalize_CBFV, window_type, window_length, overlap, overlap_adjust, na_as_mean

See TFA-parameters

Details

Using a continuous raw recording, TFA() calculates dynamic cerebral autoregulation trough a transfer function analysis. This function utilizes the recommendations from Claassen et al [1] and mimicks the matlab script created by David Simpsons in 2015.

View(data)
time abp mcav
7.00 78 45
7.01 78 46
... ... ...
301.82 82 70
301.83 81 69

To calculate the variables insert the data and select the relevant variables.

TFA(df=data, variables=c("abp","mcav"))

See Value for output description.

Value

TFA() returns a dataframe depending on the output selected. 'table' results in a dataframe with values for the three frequencies defined by Claassen et al. [1]; 'long' results in a dataframe with the results in a long format; 'plot' results in a daframe which can help plot gain, phase and coherence; 'plot-peak' results in a dataframe, which can be used to validate the cyclic average, and 'raw' results in a nested list with results primarily for debugging.

Some generic variables are listed below:

output = 'table'

Wide format output table with period, VLF, LF, and HF as columns, and the TFA-variables as rows.

period variable vlf lf hf
1 abp_power 6.25 1.56 0.21
1 cbfv_power 3.22 2.25 0.30
... ... ... ... ...
3 gain_normal 1.04 1.48 1.85
3 phase 53.0 25.4 9.38

output = 'long'

Long format output table which can be manipulated depending on the intended use, with period, interval, variables and values as columns.

period interval variable values
1 hf abp_power 6.25
1 hf cbfv_power 3.22
... ... ... ...
2 vlf gain_norm 1.85
2 vlf phase 9.38

output = 'plot'

Plot format output table which can be used to draw figures with gain, phase and coherence depending on frequency.

period freq gain phase coherence
1 0.00 0.16 0.00 0.04
1 0.01 0.29 4.22 0.29
... ... ... ... ...
2 1.55 1.15 -43.2 0.64
2 1.56 1.16 -41.1 0.42

TFA-paramters

A series of parameters that control TFA analysis (window-length, frequency bands …). If this is not provided, default values, corresponding to those recommended in the white paper, will be used. These default values are given below for each parameter.

References

  1. Claassen et al. (2016) J Cereb Blood Flow Metab. 2016 Apr;36(4):665-80. (PubMed)

Examples

df <- data.frame(seq(1, 901, 0.1),
         rnorm(9001), rnorm(9001))
TFA(df, variables=c("abp","mcav"), freq=10)


Hemodynamic Indices Calculated From Clinical Monitoring (clinmon)

Description

clinmon() uses a continuous recording and returns a dataframe with hemodynamic indices for every period, epoch or block depending on the chosen output. Calculates COest, CPPopt, CVRi, Dx, Mx, PI, PRx, PWA, RI, and Sx (see Hemodynamic indices).

Usage

clinmon(df, variables,
trigger = NULL, deleter = NULL,
blocksize = 3, epochsize = 20,
overlapping = FALSE, freq = 1000,
blockmin = 0.5, epochmin = 0.5,
output = "period", fast = FALSE)

Arguments

df

Raw continuous recording with all numeric data and first column has to be time in seconds. (dataframe)

variables

Defining the type and order of the recorded variables as a list. Middle cerebral artery blood velocity ('mcav'), Arterial blood pressure ('abp'), cerebral perfusion pressure ('cpp'), intracranial pressure ('icp'), and heart rate ('hr') is currently supported. (list)

trigger

Trigger with two columns: first is start, and second is end of periods to be analyzed. Every row corresponds to a period. Default is NULL, which results in analysis of the full dataframe. (dataframe)

deleter

Deleter with two columns: first is start and second is end of period with artefacts, which need to be deleted. Every row is a period with artefacts. Default is NULL. (dataframe)

blocksize

Length of a block, in seconds. Default is 3. (numeric)

epochsize

Size of epochs in number of blocks. Default is 20. (numeric)

overlapping

The number of block which should overlap when calculating correlation based indices, and remain blank if overlapping calculations should not be utilized. Default is FALSE. (numeric)

freq

Frequency of recorded data, in Hz. Default is 1000. (numeric)

blockmin

Minimum measurements required to create a block in ratio. Default is 0.5 corresponding to 50%. If the block holds less than the defined ratio the block will be omitted. (numeric)

epochmin

Minimum number of blocks required to create an epoch in ratio. Default is 0.5 corresponding to 50%. If the epoch holds less than the defined ration the epoch will be omitted. (numeric)

output

Select what each row should represent in the output. Correlation based indices are not presented when selecting blocks for every row. Currently 'block', 'epoch', 'period' or 'cppopt' is supported. Default is 'period'. (string)

fast

Select if you want the data to aggregated before analysis resulting in a faster, but perhaps more imprecise run, in Hz. Default is FALSE. (numeric)

Details

Using a continuous raw recording, clinmon() calculates hemodynamic indices for every period, epoch or block depending on the chosen output.

View(data)
time abp mcav
7.00 78 45
7.01 78 46
... ... ...
301.82 82 70
301.83 81 69

To calculate the indices insert the data and select the relevant variables.

clinmon(df=data, variables=c("abp","mcav"))

See Value for output description.

Value

Returns a dataframe with the results, with either every blocks, epochs or periods as rows, depending on the chosen output.

Column Description
period The period number corresponding to the row-number in the trigger file.
epoch The epoch number, or if period is chosen as output it reflects the number of epochs in the period.
block The block number, or if period or epoch is chosen as output it reflects the number of blocks in the period or epoch.
time_min The minimum time value or the period, epoch or block.
time_max The maximum time value or the period, epoch or block.
missing_percent The percentage of missing data in the period, epoch or block.
⁠*_mean⁠ The mean value of each variable for the period, epoch or block.
⁠*_min⁠ The minimum value of each variable for the period, epoch or block.
⁠*_max⁠ The maximum value of each variable for the period, epoch or block.
* The indices in each column.

Hemodynamic indices

COest | Estimated cardiac output

Required variables: abp, hr; Required output: -.

Estimated cardiac output (COest) is calculated by utilizing the method described by Koenig et al. [1]:

COest = PP / (SBP+DBP) * HR

PP: Pulse pressure; SBP: systolic blood pressure; DBP: diastolic blood pressure; HR: heart rate.

CPPopt | Optimal cerebral perfusion pressure

Required variables: abp, icp; Required output: period.

Optimal cerebral perfusion pressure (CPPopt) is calculated utilizing the method described by Steiner et al. [2]. The CPPopt return NA if CPPopt is the maximum or minimum CPP investigated. CPPopt is recommended to only be calculated after 'several hours' of recording:

CPPopt = 5 mmHg_CPP_interval_with_lowest_mean_PRx )

CPP: cerebral perfusion pressure; PRx: Pressure reactivity index.

CVRi | Cardiovascular resistance index

Required variables: abp, mcav; Required output: -.

Cardiovascular resistance index (CVRi) is calculated utilizing the method described by Fan et al. [3]:

CVRi = mean ABP / mean MCAv

ABP: arterial blood pressure; MCAv: middle cerebral artery blood velocity.

Dx | Diastolic flow index

Required variables: cpp/abp, mcav; Required output: epoch, period.

Diastolic flow index (Dx) is calculated utilizing the method described by Reinhard et al. [4]:

Dx = cor( mean CPP / min MCAv )

Dxa = cor( mean ABP / min MCAv )

cor: correlation coefficient; CPP: cerebral perfusion pressure; ABP: arterial blood pressure; MCAv: middle cerebral artery blood velocity.

Mx | Mean flow index

Required variables: cpp/abp, mcav; Required output: epoch, period.

Mean flow index (Mx) is calculated utilizing the method described by Czosnyka et al. [5]:

Mx = cor( mean CPP / mean MCAv )

Mxa = cor( mean ABP / mean MCAv )

cor: correlation coefficient; CPP: cerebral perfusion pressure; ABP: arterial blood pressure; MCAv: middle cerebral artery blood velocity.

PI | Gosling index of pulsatility

Required variables: mcav; Required output: -.

Gosling index of pulsatility (PI) is calculated utilizing the method described by Michel et al. [6]:

PI = (systolic MCAv - diastolic MCAv) / mean MCAv

MCAv: middle cerebral artery blood velocity.

PRx | Pressure reactivity index

Required variables: abp, icp; Required output: epoch, period.

Pressure reactivity index (PRx) is calculated utilizing the method described by Czosnyka et al. [7]:

PRx = cor( mean ABP / mean ICP )

cor: correlation coefficient; CPP: cerebral perfusion pressure; ICP: intracranial pressure.

PWA | Pulse wave amplitude

Required variables: cpp/icp/abp/mcav; Required output: -.

Pulse wave amplitude (PWA) is calculated utilizing the method described by Norager et al. [8]:

PWA = systolic - diastolic

RI | Pourcelots resistive (resistance) index

Required variables: mcav; Required output: -.

Pourcelots resistive (resistance) index (RI) is calculated utilizing the method described by Forster et al. [9]:

RI = (systolic MCAv - diastolic MCAv) / systolic MCAv

MCAv: middle cerebral artery blood velocity.

Sx | Systolic flow index

Required variables: cpp/abp, mcav; Required output: epoch, period.

Systolic flow index (Sx) is calculated utilizing the method described by Czosnyka et al. [5]:

Sx = cor( mean CPP / systolic MCAv )

Sxa = cor( mean ABP / systolic MCAv )

cor: correlation coefficient; CPP: cerebral perfusion pressure; ABP: arterial blood pressure; MCAv: middle cerebral artery blood velocity.

References

  1. Koenig et al. (2015) Biomed Sci Instrum. 2015;51:85-90. (PubMed)

  2. Steiner et al. (2002) Crit Care Med. 2002 Apr;30(4):733-8. (PubMed)

  3. Fan et al. (2018) Front Physiol. 2018 Jul 16;9:869. (PubMed)

  4. Reinhard et al. (2003) Stroke. 2003 Sep;34(9):2138-44. (PubMed)

  5. Czosnyka et al. (1996) Stroke. 1996 Oct;27(10):1829-34. (PubMed)

  6. Michel et al. (1998) Ultrasound Med Biol. 1998 May;24(4):597-9. (PubMed)

  7. Czosnyka et al. (1997) Neurosurgery. 1997 Jul;41(1):11-7; discussion 17-9. (PubMed)

  8. Norager et al. (2020) Acta Neurochir (Wien). 2020 Dec;162(12):2983-2989. (PubMed)

  9. Forster et al. (2017) J Paediatr Child Health. 2018 Jan;54(1):61-68. (PubMed)

Examples


data(testdata)
clinmon(df.data10, variables=c('abp','mcav','hr'), freq=10)


Test-data (10 Hz)

Description

Recording with four columns: time (t), non-invasive arterial blood pressure (abp), middle cerebral artery velocity measured using transcranial Doppler (mcav), and heart rate (hr).

Usage

data(testdata)

Format

An object of class "dataframe"; an example of the usage in clinmon.

Source

GitHub

References

Olsen MH et al. (Unpublished data, 2020) (GitHub)

Examples

data(testdata)
variables <- c("abp","mcav","hr")
clinmon(df.data10,variables,freq=10)

Test-data (1000 Hz)

Description

Recording with four columns: time (t), non-invasive arterial blood pressure (abp), middle cerebral artery velocity measured using transcranial Doppler (mcav), and heart rate (hr).

Usage

data(testdata)

Format

An object of class "dataframe"; an example of the usage in clinmon.

Source

GitHub

References

Olsen MH et al. (Unpublished data, 2020) (GitHub)

Examples

data(testdata)
variables <- c("abp","mcav","hr")
clinmon(df.data1000,variables,fast=50)

Test-deleter

Description

Deleter dataframe with two columns: start (start) and end (end) of the deleter-period.

Usage

data(testdata)

Format

An object of class "dataframe"; an example of the usage in clinmon.

Source

GitHub

References

Olsen MH et al. (Unpublished data, 2020) (GitHub)

Examples

data(testdata)
variables <- c("abp","mcav","hr")
clinmon(df.data1000,variables,deleter=df.deleter,fast=50)