Draw the model's vector field over a plane of the latent state space: at each point, the direction and speed the deterministic part of the system moves. For a model whose matrices depend on the latent state – the reason the julia backend exists – this shows behaviour that no single reported DRIFT matrix can, because there is no single DRIFT matrix.
Usage
ctPhasePortrait(
fit,
latents = 1:2,
extent = "data",
gridsize = 15,
state = "asymptotic",
tipreds = NULL,
nullclines = TRUE,
fixedpoint = TRUE,
trajectories = 0,
plot = TRUE
)Arguments
- fit
A ctJuliaFit, or a ctStanFit of a linear model.
- latents
Two latent processes, by name or index, forming the plane.
- extent
'data'(the default) spans the smoothed latent states,'sd'spans two stationary standard deviations either side of T0MEANS, or supply a list of two numeric ranges.- gridsize
Arrows per side. The field costs one engine call per point, so cost is quadratic in this.
- state
Where the *other* latent processes are held, as in
ctDiscretePars:'asymptotic','mean','T0MEANS', or a numeric state.- tipreds
Time independent predictor values, or NULL for the population.
- nullclines
Draw the curves where each process stops changing?
- fixedpoint
Mark the asymptotic state when it is inside the region?
- trajectories
Number of subjects' smoothed trajectories to overlay, or 0 for none.
- plot
If FALSE, return the field, nullclines and trajectories as data rather than a plot.
Value
A ggplot, or when plot=FALSE a list with field, the
latents on the plane, stateLabel naming where the off-plane
processes were held, the held process names, and nullclines,
fixedpoint and trajectories when asked for. The plot names
stateLabel in its subtitle whenever anything is held off-plane.
Details
Three things are drawn over the field, each of which can be turned off:
Nullclines, the curves where one process stops changing. Where the nullclines of two processes cross, the whole system stops: that is a fixed point, and a nonlinear system may have several.
The fixed point found by
state='asymptotic', marked when it lies inside the plotted region. Only one is found, by Newton from T0MEANS; the nullcline crossings show whether there are others.Smoothed trajectories for a few subjects, so the field can be read against where the data actually went.
With more than two latent processes the remaining ones are held at
state, so the picture is a slice rather than the whole story –
change state and the slice changes.
A linear model has an affine field, straight nullclines and exactly one fixed point. It is drawn correctly, from a stan fit as readily as a julia one, but it shows nothing the DRIFT matrix did not already say. A nonlinear stan fit is refused rather than drawn as if it were linear.