View source: R/Calc Area under the curve.r
Area | R Documentation |
Area under the curves in the Phi(DeltaT)-plot, for time-intervals from 0 to infinity and optionally for a user-specified range. The interactive web application 'Phi-and-Psi-Plots and Find DeltaT' also contains this functionality, you can find it on my website: https://www.uu.nl/staff/RMKuiper/Websites%20%2F%20Shiny%20apps.
Area(DeltaT = 1, Phi = NULL, Drift = NULL, t_min = 0, t_max = "inf")
DeltaT |
Optional. The time interval used (only of interest if Phi is part of input). By default, DeltaT = 1. |
Phi |
Matrix of size q times q of (un)standardized lagged effects. It also takes a fitted object from the classes "varest" (from the VAR() function in vars package) and "ctsemFit" (from the ctFit() function in the ctsem package); see example below. From such an object, the (standardized) Drift matrix is calculated/extracted. |
Drift |
Optional (either Phi or Drift). Matrix of size q times q of (un)standardized continuous-time lagged effects, called drift matrix. Note that Phi(DeltaT) = expm(Drift*DeltaT). By default, input for Phi is used; only when Phi = NULL, Drift will be used. |
The output renders, per element (i,j), the area under the curve for Phi_ij.
# library(CTmeta)
## Example 1 ##
##################################################################################################
# Input needed in examples below with q=2 variables.
# I will use the example matrices stored in the package:
DeltaT <- 1
Phi <- myPhi[1:2, 1:2]
# or: Drift
DeltaT <- 1
Drift <- myDrift
##################################################################################################
Area(DeltaT = DeltaT, Phi = Phi)
# or
Area(DeltaT, Phi)
# or, since DeltaT = 1
Area(Phi = Phi)
# If you would use the drift matrix Drift as input, then use:
Area(DeltaT, Drift = Drift)
# If, for instance, the time-interval range from 1 to 2 should be inspected (and not 0 to infinity), then use:
Area(DeltaT, Phi, t_min = 1, t_max = 2)
# Note that the function 'PhiPlot' can help for visualization of the curves in the Phi(DeltaT)-plot.
PhiPlot(DeltaT, Phi)
## Example 2: input from fitted object of class "varest" ##
#
data <- myData
if (!require("vars")) install.packages("vars")
library(vars)
out_VAR <- VAR(data, p = 1)
DeltaT <- 1
Area(DeltaT, out_VAR)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.