predict,lnm-method {miniLNM}R Documentation

LNM Fitted Probabilities

Description

Given an input dataset, predict the output composition. Specifically, this outputs \phi^{-1}(Bx), for the inverse log ratio transformation \phi^{-1} and fitted covariate matrix B.

Usage

## S4 method for signature 'lnm'
predict(object, newdata = NULL, ...)

Arguments

object

An object of class lnm with fitted parameters \hat{B} and which we want to use to form predictions on new samples.

newdata

New samples on which to form predictions. Defaults to NULL, in which case predictions are made at the same design points as those used during the original training.

...

Additional keyword arguments, for consistency with R's predict generic (never used).

Value

A matrix with predictions along rows and outcomes along columns. Rows sum up to one.

Examples

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
)
head(predict(fit))

[Package miniLNM version 0.1.0 Index]