Skip to content

Calculate Area Under the Curve Using Trapezoidal Rule

License

Notifications You must be signed in to change notification settings

anikoszabo/AUCtrap

Repository files navigation

AUCtrap: AUC calculation using the trapezoidal rule

The goal of the AUCtrap package is to provide utilities for calculating the area under the curve for longitudinal measurements.

Installation

You can install the development version of AUCtrap from GitHub with:

# install.packages("devtools")
devtools::install_github("anikoszabo/AUCtrap")

Example

This is a basic example which shows you how to solve a common problem:

library(AUCtrap)
AUCtrap(0:3, c(3,4,1,2))
#> 7.5 using method AUC
AUCtrap(0:3, c(3,4,1,2), method="iAUC")
#> 0.6666667 using method iAUC
AUCtrap(0:3, c(3,4,1,2), method="minAUC")
#> 4.5 using method minAUC

A formula can be used:

dd <- data.frame(Time = 0:4, Value = c(3,4,1,2,10))
AUCtrap(Value ~ Time, data=dd)
#> 13.5 using method AUC

ex2 <- AUCtrap(0:3, c(3,4,1,2), method="iAUC")
ex2
#> 0.6666667 using method iAUC
plot(ex2)

ex.min <- AUCtrap(0:3, c(3,4,1,2), method="minAUC")
plot(ex.min)
AUCtrap(Value ~ Time, data=dd, subset=Time < 4, method="minAUC")

About

Calculate Area Under the Curve Using Trapezoidal Rule

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages