logLik.BTM {BTM} | R Documentation |
Get the likelihood of biterms in a BTM model
Description
Get the likelihood how good biterms are fit by the BTM model
Usage
## S3 method for class 'BTM'
logLik(object, data = terms.BTM(object, type = "biterms")$biterms, ...)
Arguments
object |
an object of class BTM as returned by |
data |
a data.frame with 2 columns term1 and term2 containing biterms. Defaults to the biterms used to construct the model. |
... |
other arguments not used |
Value
a list with elements
likelihood: a vector with the same number of rows as
data
containing the likelihood of the biterms alongside the BTM model. Calculated assum(phi[term1, ] * phi[term2, ] * theta)
.-
ll
the sum of the log of the biterm likelihoods
See Also
Examples
library(udpipe)
data("brussels_reviews_anno", package = "udpipe")
x <- subset(brussels_reviews_anno, language == "nl")
x <- subset(x, xpos %in% c("NN", "NNP", "NNS"))
x <- x[, c("doc_id", "lemma")]
model <- BTM(x, k = 5, iter = 5, trace = TRUE, detailed = TRUE)
fit <- logLik(model)
fit$ll
[Package BTM version 0.3.7 Index]