topicVar {maptpx} | R Documentation |
topic variance
Description
Tools for looking at the variance of document-topic weights.
Usage
topicVar(counts, theta, omega)
logit(prob)
expit(eta)
Arguments
counts |
A matrix of multinomial response counts, as inputed to the |
theta |
A fitted topic matrix, as ouput from the |
omega |
A fitted document topic-weight matrix, as ouput from the |
prob |
A probability vector (positive and sums to one) or a matrix with probability vector rows. |
eta |
A vector of the natural exponential family parameterization for a probability vector (with first category taken as null) or a matrix with each row the NEF parameters for a single observation. |
Details
These function use the natural exponential family (NEF) parametrization of a probability vector with the first element corresponding to a 'null' category; that is, with
and setting
, the probabilities are
Refer to Taddy (2012) for details.
Value
topicVar
returns an array with dimensions , where
K=ncol(omega)=ncol(theta)
and n = nrow(counts) = nrow(omega)
, filled with the posterior covariance matrix for the NEF parametrization of each row of omega
. Utility logit
performs the NEF transformation and expit
reverses it.
Author(s)
Matt Taddy mataddy@gmail.com
References
Taddy (2012), On Estimation and Selection for Topic Models. http://arxiv.org/abs/1109.4518
See Also
topics, predict.topics