Add slow processes that drive a model's latent processes
Source:R/ctModelSlowComponent.R
ctModelSlowComponent.RdEach latent in indices gains a slow latent, named slow_ and
the latent's name, that drives it through the drift: an estimated effect
DRIFT[k, slow_k] moves the level the latent returns to with the slow
process, so a process can wander over weeks while it fluctuates over hours.
Its equilibrium is DRIFT[k, slow_k] / |DRIFT[k, k]| times the slow
process, so a person with faster dynamics follows the slow process less
closely.
Usage
ctModelSlowComponent(ctm, indices = seq_len(ctm$n.latent))Details
A slow process is slower than the latent it drives by construction: its
drift is the latent's times inv_logit(r), with r a
PARS parameter named drift_ and the slow process's name, so
its rate is a fraction of the latent's. Left free, the two rates can trade
places: with only the latent measured, a latent of drift a driven by
a slow process of drift b has the spectrum of one with the two
exchanged and the effect adjusted, so the "slow" process can come out the
fast one, and refits from other starting values did. The latent's drift
parameter is declared in PARS for this, keeping its name,
transform, individual variation and predictor effects, so where the
latent's rate varies over people the slow process's follows it. Where the
latent's drift is fixed the fraction is of that value; where it is an
expression the slow process's persistence is left free, as before.
A slow process has innovations of unit variance (the effect carries its
scale), correlated with those of the other slow processes, including ones
added earlier, and not with the fast ones.
It has no loadings and no intercept, and no individual variation or
predictor effects. Its initial mean and variance are its stationary ones
(T0MEANS and the T0VAR diagonal 'stationary', see
ctFit): zero and 1 / (2 |a|) for persistence
a. Its initial covariance with the latent it drives is free – that
latent follows it, so the two start related – and with the other states
zero.
The effect has to start away from zero. At zero neither the slow process nor
its effect has a gradient, so an optimiser started there stays. When
refitting from a model without the slow process, start the effect at one
(the slow process's sign is not identified, so either sign will do) and
the fraction small; ctModelImprove starts it at a tenth.
See also
ctModelHigherOrder for the other structural extension
the search tries.
Examples
m <- ctModel(type = 'ct', manifestNames = c('Y1', 'Y2'),
latentNames = c('eta1', 'eta2'), LAMBDA = diag(2))
m2 <- ctModelSlowComponent(m, 1:2)
m2$latentNames
p <- m2$pars
p[p$matrix %in% c('DRIFT', 'DIFFUSION') & (p$row > 2 | p$col > 2) &
(!is.na(p$param) | p$value != 0), c('matrix', 'row', 'col', 'param', 'value')]