Learn R Programming

miniLNM (version 0.1.0)

beta_samples: LNM Posterior Samples

Description

Return multiple samples for the beta parameter from the VB posterior mean. This is used to simulate new compositions when using sample on an lnm model.

Usage

beta_samples(fit, size = 1)

Value

A matrix whose rows are predictors and columns are outcomes in the beta parameter for the LNM model.

Arguments

fit

An object of class lnm whose estimate slot contains the 'rstan' fitted logistic normal multinomial model.

size

The number of draws from the posterior to return.

Examples

Run this code
example_data <- lnm_data(N = 50, K = 10)
xy <- dplyr::bind_cols(example_data[c("X", "y")])
fit <- lnm(
    starts_with("y") ~ starts_with("x"), xy, 
    iter = 25, output_samples = 25
)
beta_samples(fit, size = 2)

Run the code above in your browser using DataLab