Sldax-class: S4 class to represent a SLDAX general model that inherits...

Description Usage Arguments Value Slots Examples

Description

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

Helper function (constructor) for Sldax class

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
## S4 method for signature 'Sldax'
topics(x)

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

## S4 method for signature 'Sldax'
theta(x)

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

## S4 method for signature 'Sldax'
beta_(x)

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

## S4 method for signature 'Sldax'
gamma_(x)

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

## S4 method for signature 'Sldax'
alpha(x)

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

## S4 method for signature 'Sldax'
ntopics(x)

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

## S4 method for signature 'Sldax'
nvocab(x)

## S4 replacement method for signature '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

1
2
3
4
5
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

ktw5691/psychtm documentation built on Nov. 3, 2021, 9:10 a.m.