tic_auc: Return area under curve from time-intensity data

View source: R/tic_auc.R

tic_aucR Documentation

Return area under curve from time-intensity data

Description

This function returns area under curve from raw time intensity curves using the trapezoid method. It is recommended that plotresult is set to TRUE in the first instance to visually confirm the analysis.

Usage

tic_auc(data, timevar, intensityvar, AUCmax = NULL, plotresult = FALSE)

Arguments

data

A dataframe with time and intensity values as columns.

timevar

A character string (in quotes) with the dataframe column name for the time variable.

intensityvar

A character string (in quotes) with dataframe column name for the intensity variable.

AUCmax

A number - the maximum time that area under the curve is measured until.

plotresult

TRUE or FALSE to determine whether a plot of the results is generated.

Details

A plot of the data is generated and a dataframe with the results is returned.

Value

Area under the curve. Depending on the plotresult argument can also return a plot of the raw data.

Examples


# Example usage:

# Generating simulated data
set.seed(123)
example_data <- data.frame(time = seq(0, 82, by = 0.25))
random_vals <- sample(1:10, nrow(example_data), replace = TRUE)
example_data$regionA_intensity <- log(example_data$time + 1) * 50 -
  example_data$time * 2 + random_vals
example_data$regionB_intensity <- log(example_data$time + 7, base = 10) *
  80 - example_data$time * 1.5 + random_vals

# Example with defaults:

tic_auc(data = example_data, timevar = "time", intensityvar = "regionA_intensity")

# Example with additional arguments:

tic_auc(data = example_data, timevar = "time", intensityvar = "regionA_intensity",
                   AUCmax = 30, plotresult = TRUE)



tican documentation built on June 8, 2025, 11:05 a.m.