ecmerkle / blavaan

An R package for Bayesian structural equation modeling
https://ecmerkle.github.io/blavaan
87 stars 23 forks source link

Use number of samples available in the posterior for `sampleData` #77

Closed lunafazio closed 7 months ago

lunafazio commented 7 months ago

Currently sampleData takes the number of posterior samples reported by blavInspect(_, 'options') , but the actual number of available samples might be lower if the user also requested thinning via bcontrol.

For consistency, I took the approach that blavPredict uses to obtain the number of samples.

As an interesting fact, the reason this was not producing any errors is that this line, when given thin > nsamps, produces a vector with non-integer indices, which R just silently rounds down during subsetting.

ecmerkle commented 7 months ago

Thanks!