lnm_sampler: Sample from the Logistic Normal Multinomial

View source: R/estimators.R

lnm_samplerR Documentation

Sample from the Logistic Normal Multinomial

Description

This samples from the posterior predictive of a fitted logistic-normal multinomial model.

Usage

lnm_sampler(fit, newdata = NULL, indices = NULL, ...)

Arguments

fit

The fitted LNM model from which to draw posterior predictive samples.

newdata

A data.frame containing new inputs from which to sample responses. If NULL, defaults to the data used to estimate fit.

indices

The coordinates of the response from which to draw samples.

...

Additional parameters passed to sample.

Value

y_star A data.frame of samples y associated wtih the new inputs.

Examples

m <- lnm_model()
mat <- data.frame(matrix(rpois(250, 10), 25, 10))
colnames(mat) <- paste0("y", 1:6)
fit <- estimator(m)(y1 + y2 + y3 + y4 ~ y5 + y6, mat)
lnm_sampler(fit, depth = 10)
lnm_sampler(fit, depth = 100)

multimedia documentation built on Sept. 30, 2024, 9:28 a.m.