Genentech / jmpost

https://genentech.github.io/jmpost/
17 stars 4 forks source link

Prints incorrect number of chains for JointModelSamples #356

Closed gravesti closed 5 months ago

gravesti commented 5 months ago

Printing a JointModelSamples object appears to have the wrong number of chains

mp <-  sampleStanModel(
            jm,
            data = jdat,
            iter_sampling = 1000,
            iter_warmup = 1000,
            chains = 3,
            parallel_chains = 4
        )
mp

prints

   JointModelSamples Object with:

      # of samples per chain = 1000
      # of chains            = 1

      Variables:
          beta_os_cov[3]
          link_coefficients
          ...

but I expect number of chains should be 3.

This comes from https://github.com/Genentech/jmpost/blob/c29f73f63ffe693220741358e02f80c86e5f7180/R/JointModelSamples.R#L107 and I think it should be

 as.CmdStanMCMC(object)$num_chains()

eg

as.CmdStanMCMC(mp)$num_chains()
[1] 3