Learn R Programming

psychtm (version 2021.1.0)

Sldax-class: S4 class to represent a SLDAX general model that inherits from '>Mlr and '>Logistic.

Description

S4 class to represent a SLDAX general model that inherits from '>Mlr and '>Logistic.

Helper function (constructor) for Sldax class

Usage

# S4 method for Sldax
topics(x)

# S4 method for Sldax topics(x) <- value

# S4 method for Sldax theta(x)

# S4 method for Sldax theta(x) <- value

# S4 method for Sldax beta_(x)

# S4 method for Sldax beta_(x) <- value

# S4 method for Sldax gamma_(x)

# S4 method for Sldax gamma_(x) <- value

# S4 method for Sldax alpha(x)

# S4 method for Sldax alpha(x) <- value

# S4 method for Sldax ntopics(x)

# S4 method for Sldax ntopics(x) <- value

# S4 method for Sldax nvocab(x)

# S4 method for Sldax nvocab(x) <- value

Sldax(nvocab, topics, theta, beta, ntopics = 2, alpha = 1, gamma = 1, ...)

Arguments

x

An Sldax object.

value

A value to assign to a slot for x

nvocab

The number of terms in the corpus vocabulary.

topics

A D x max(N_d) x M numeric array of topic draws. 0 indicates an unused word index (i.e., the document did not have a word at that index).

theta

A D x K x M numeric array of topic proportions.

beta

A K x V x M numeric array of topic-vocabulary distributions.

ntopics

The number of topics for the LDA model (default: 2).

alpha

A numeric prior hyperparameter for theta (default: 1.0).

gamma

A numeric prior hyperparameter for beta (default: 1.0).

...

additional arguments to be passed to the low level regression fitting functions (see below).

Value

A '>Sldax object.

Slots

nvocab

The number of terms in the corpus vocabulary.

ntopics

The number of topics for the LDA model.

alpha

A numeric prior hyperparameter for theta.

gamma

A numeric prior hyperparameter for beta.

topics

A D x max(N_d) x M numeric array of topic draws. 0 indicates an unused word index (i.e., the document did not have a word at that index).

theta

A D x K x M numeric array of topic proportions.

beta

A K x V x M numeric array of topic-vocabulary distributions.

Examples

Run this code
# NOT RUN {
m1 <- Sldax(ndocs = 1, nvocab = 2,
            topics = array(c(1, 2, 2, 1), dim = c(1, 4, 1)),
            theta = array(c(0.5, 0.5), dim = c(1, 2, 1)),
            beta = array(c(0.5, 0.5, 0.5, 0.5), dim = c(2, 2, 1)))
nvocab(m1) <- 2L
# }

Run the code above in your browser using DataLab