ChecksCTM: Checks on CT estimates

View source: R/Checks on CTMparameters.r

ChecksCTMR Documentation

Checks on CT estimates

Description

Checks on the continuous-time lagged-effects model matrices (like check whether matrices are positive-definite). 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.

Usage

ChecksCTM(Drift, Sigma = NULL, Gamma = NULL)

Arguments

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. It also takes a fitted object from the class "ctsemFit" (from the ctFit() function in the ctsem package); see example below. From such an object, the (standardized) Drift matrix is extracted.

Sigma

Residual covariance matrix of the first-order continuous-time (CT-VAR(1)) model, that is, the diffusion matrix. By default, input for SigmaVAR is used; only when SigmaVAR = NULL, Sigma will be used.

Gamma

Optional (either Sigma or Gamma). Stationary covariance matrix, that is, the contemporaneous covariance matrix of the data. By default, input for SigmaVAR is used; only when SigmaVAR = NULL, Gamma will be used. Note that if Drift and Sigma are known, Gamma can be calculated; hence, only one out of SigmaVAR, Sigma, and Gamma is needed as input.

Value

The output renders the conclusions from the checks on the continuous-time lagged-effects model matrices.

Examples


# library(CTmeta)

## Example 1 ##

##################################################################################################
# Input needed in examples below with q=2 variables.
# I will use the example matrix stored in the package:
Drift <- myDrift
#
q <- dim(Drift)[1]
Sigma <- diag(q) # for ease
#
Gamma <- Gamma.fromCTM(Drift, Sigma)
##################################################################################################

ChecksCTM(Drift, Sigma)
# or
ChecksCTM(Drift, Gamma = Gamma)


## Example 2: input from fitted object of class "ctsemFit" ##
#
#data <- myData
#if (!require("ctsemFit")) install.packages("ctsemFit")
#library(ctsemFit)
#out_CTM <- ctFit(...)
#ChecksCTM(out_CTM)


rebeccakuiper/CTmeta documentation built on Nov. 2, 2024, 4:42 p.m.