Skip to contents

The two graphs network psychometrics draws from a multivariate time series – the directed temporal network and the undirected contemporaneous network – computed from a ctsem model specification or from a fit on either backend.

Both are functions of the time interval, which is what a continuous time model has to say here that a discrete time VAR does not. Call it at several dt and the networks change shape, not merely scale.

Usage

ctNetwork(
  x,
  dt = 1,
  state = NULL,
  standardise = TRUE,
  impulseType = "unit",
  threshold = 0,
  networks = c("temporal", "contemporaneous"),
  plot = FALSE,
  quiet = FALSE,
  ...,
  observational
)

Arguments

x

A ctStanModel from ctModel, or a fit from ctFit on either backend.

dt

Time interval for the temporal and contemporaneous networks. A whole number of steps for a discrete time model. Length one; to see the interval dependence, call ctNetworkPlot with a vector.

state

Where a state dependent cell is evaluated, when x is a fit: 'T0MEANS' (the default, and what ctSummaryMatrices uses), 'mean' for the mean smoothed latent state, 'asymptotic' for the system's own fixed point, or a numeric state vector. Only backend='julia' can re-materialise the matrices elsewhere, so anything but the default is an error on a stan fit rather than being quietly ignored. Irrelevant to a linear model, and to an unfitted specification.

standardise

If TRUE (the default), temporal edges are in standard deviation units of the processes themselves, using asymDIFFUSIONcov, so edges between processes on different scales are comparable. Falls back to FALSE, with a message, when the system has no stationary variance to standardise by.

impulseType

What a one unit change in a process brings with it; see ctDiscretePars, whose argument this is. 'unit' (the default) is an impulse of one to that process alone – the partial regression, and a property of the dynamics alone.

threshold

Edges with abs(weight) at or below this are dropped from $edges and from any plot. The matrices are never thresholded.

networks

Which networks appear in $edges and in the plot. Any of 'temporal', 'contemporaneous', 'asymptotic', 'measurement'. All four matrices are computed regardless.

plot

If TRUE, returns the ctNetworkPlot of the result instead of the result.

quiet

Suppress the messages about how the numbers were arrived at.

...

Passed to ctSummaryMatrices when x is a fit, and to ctNetworkPlot when plot=TRUE.

observational

Deprecated. Use impulseType.

Value

A list of class ctNetwork:

temporal, contemporaneous, asymptotic, measurement

Weight matrices with the model's own names, ready to hand to qgraph::qgraph(). asymptotic may be NULL.

edges

Tidy data frame: network, from, to, weight, directed, self. Thresholded, and restricted to networks.

nodes

Data frame of name and type ('latent' or 'manifest').

DRIFT, DIFFUSIONcov, asymDIFFUSIONcov, innovation

The matrices the networks were derived from, so every number above can be checked. On a julia fit DRIFT is the drift's Jacobian at the evaluation point, DRIFT itself where no cell reads the state (see the section on state dependent models).

With attributes dt, standardise, impulseType, threshold, networks, continuoustime, source, stateLabel (the evaluation point, for a fit) and stateDependent (the cells with no single value, or NULL).

Details

Three networks over the latent processes, plus the measurement model:

temporal

expm(DRIFT * dt), the discrete time autoregression and cross-lagged matrix at interval dt. Directed, with the diagonal as self-loops (the autoregressions). Cell [i,j] is the effect of process j now on process i one interval later, so an edge runs from the column to the row. This is ctDiscretePars at a single interval, and shares its impulseType and standardise arguments.

contemporaneous

Partial correlations of the innovation covariance accumulated over dt, Q(dt) = int_0^dt expm(DRIFT s) DIFFUSIONcov t(expm(DRIFT s)) ds. This is the continuous time counterpart of the graphicalVAR contemporaneous network. Partial correlations are scale free, so as dt shrinks this tends to the partial correlations of DIFFUSIONcov itself, and as dt grows to those of the asymptotic covariance.

asymptotic

Partial correlations of asymDIFFUSIONcov, the long run within-subject covariance – the network a cross-sectional study of a stationary system would see. NULL if the system is not stationary.

measurement

LAMBDA, as a bipartite manifest by latent graph. Directed from latent to manifest.

From a fit, the matrices are the posterior medians ctSummaryMatrices reports. From an unfitted specification, a fixed cell is its own value and a free cell takes the value its transform gives at a raw parameter of zero, which is where estimation starts; how many DRIFT, DIFFUSION and LAMBDA cells were treated that way is reported, those being the only matrices an edge can come from.

State dependent and nonlinear models

A DRIFT, DIFFUSION or LAMBDA cell may be written as an expression referencing a latent process, and then there is no such thing as the network. What a fit reports is the system linearised at one point of the state space, so the graph drawn from it is that linearisation's graph: somewhere else the edge weights differ, and for a strongly nonlinear model so does which edges are there at all. The temporal and contemporaneous networks then come from the drift's Jacobian at that point (JAx) and the measurement network from the measurement's (Jy), which differ from DRIFT and LAMBDA there where a cell is nonlinear in the state: a cell a + b*Y in the column of process Y has slope a + 2*b*Y. A stan fit reports no Jacobians, so its edges are the cells' values at T0MEANS, and it says so.

When any such cell is present, ctNetwork says so once, names the evaluation point, and records the cells in attr(x, 'stateDependent'); ctNetworkPlot puts the point in the figure's subtitle so a saved plot carries its own caveat. Use state to move the point, and ctPhasePortrait or ctStateDependencePlot to see the variation itself rather than one slice of it. Nothing is said for a linear model, whose matrices are the same everywhere.

From an unfitted specification such a cell is reported and left out instead, since filling it in would draw a model that was not written.

See also

ctNetworkPlot to draw it, ctDiscretePars for the temporal network across a continuum of intervals, ctPhasePortrait and ctStateDependencePlot for what a state dependent system does away from the point these edges were evaluated at.

Examples

# Two processes, b driven by a, drawn at one interval.
m <- ctModel(type='ct', n.latent=2, n.manifest=2,
  manifestNames=c('y1','y2'), latentNames=c('a','b'),
  LAMBDA=diag(2),
  DRIFT=matrix(c(-1, 0, .5, -2), 2, 2, byrow=TRUE),
  DIFFUSION=matrix(c(1, 0, .3, 1), 2, 2, byrow=TRUE))

net <- ctNetwork(m, dt=1, standardise=FALSE)
round(net$temporal, 4)          # exp(-1) and exp(-2) on the diagonal
round(net$contemporaneous, 4)
net$edges