When monitor=".*" is set in sims_simulate, both the data and the latent variables are saved but only the data can be taken as input for an analysis.
Example:
sims_simulate("Y ~ dnorm(N, 1)
N ~ dnorm(mu, 1)
mu ~ dnorm(0, 1)")
$N
[1] -0.1351718
$Y
[1] -0.1492502
$mu
[1] -0.1449531
an nlists object of 100 nlist objects each with 3 natomic elements
Here, only Y is data, so the output of sims_simulate cannot be analysed directly. Instead, one needs to specify monitor manually, which could get cumbersome with many data variables.
It seems that it would be better to change the default value of monitor in sims_simulate to only keep the data. Nodes that are data can be identified by the fact that they are never used on the right hand side of a ~ or <-
I suggest adding a function to sims that would take code as input and output a list of
the nodes that are data,
the nodes that are latent,
the nodes that are parameters.
This way if for some reason someone is interested in the latent parameters, they can easily get the names of all such parameters and use them as monitor.
When monitor=".*" is set in sims_simulate, both the data and the latent variables are saved but only the data can be taken as input for an analysis.
Example:
sims_simulate("Y ~ dnorm(N, 1) N ~ dnorm(mu, 1) mu ~ dnorm(0, 1)")
$N [1] -0.1351718
$Y [1] -0.1492502
$mu [1] -0.1449531
an nlists object of 100 nlist objects each with 3 natomic elements
Here, only Y is data, so the output of sims_simulate cannot be analysed directly. Instead, one needs to specify monitor manually, which could get cumbersome with many data variables.
It seems that it would be better to change the default value of monitor in sims_simulate to only keep the data. Nodes that are data can be identified by the fact that they are never used on the right hand side of a ~ or <-
I suggest adding a function to sims that would take code as input and output a list of
This way if for some reason someone is interested in the latent parameters, they can easily get the names of all such parameters and use them as monitor.