audrey-b / simanalyse

A package to analyse simulation study data and summarise the results
GNU General Public License v3.0
3 stars 4 forks source link

latent variables passed to sma_analyse #2

Closed audrey-b closed 5 years ago

audrey-b commented 5 years ago

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

  1. the nodes that are data,
  2. the nodes that are latent,
  3. 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.

audrey-b commented 5 years ago

Moved to sims