Model-class: An S4 super class to represent a regression-like model

Description Usage Arguments Value Slots Examples

Description

An S4 super class to represent a regression-like model

Helper function (constructor) for Model 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
## S4 method for signature 'Model'
ndocs(x)

## S4 replacement method for signature 'Model'
ndocs(x) <- value

## S4 method for signature 'Model'
nchain(x)

## S4 replacement method for signature 'Model'
nchain(x) <- value

## S4 method for signature 'Model'
mu0(x)

## S4 replacement method for signature 'Model'
mu0(x) <- value

## S4 method for signature 'Model'
sigma0(x)

## S4 replacement method for signature 'Model'
sigma0(x) <- value

## S4 method for signature 'Model'
eta_start(x)

## S4 replacement method for signature 'Model'
eta_start(x) <- value

## S4 method for signature 'Model'
eta(x)

## S4 replacement method for signature 'Model'
eta(x) <- value

## S4 method for signature 'Model'
loglike(x)

## S4 replacement method for signature 'Model'
loglike(x) <- value

## S4 method for signature 'Model'
logpost(x)

## S4 replacement method for signature 'Model'
logpost(x) <- value

## S4 method for signature 'Model'
waic(x)

## S4 replacement method for signature 'Model'
waic(x) <- value

## S4 method for signature 'Model'
se_waic(x)

## S4 replacement method for signature 'Model'
se_waic(x) <- value

## S4 method for signature 'Model'
p_eff(x)

## S4 replacement method for signature 'Model'
p_eff(x) <- value

## S4 method for signature 'Model'
lpd(x)

## S4 replacement method for signature 'Model'
lpd(x) <- value

## S4 method for signature 'Model'
extra(x)

## S4 replacement method for signature 'Model'
extra(x) <- value

Model(
  ndocs,
  nchain = 1,
  mu0 = NaN,
  sigma0 = NaN,
  eta_start = NaN,
  eta = NaN,
  loglike = NaN,
  logpost = NaN,
  waic = NaN,
  se_waic = NaN,
  p_eff = NaN,
  lpd = NaN
)

Arguments

x

An Model object.

value

A value to assign to a slot for x

ndocs

The number of documents/observations.

nchain

The number of iterations of the Gibbs sampler.

mu0

A (p + 1) x 1 matrix of prior means for eta.

sigma0

A (p + 1) x (p + 1) prior covariance matrix for eta.

eta_start

A (p + 1) x 1 matrix of starting values for eta.

eta

A nchain x (p + 1) matrix of draws of regression coefficients.

loglike

A nchain x 1 vector of the log-likelihood (up to an additive constant).

logpost

A nchain x 1 vector of the log-posterior (up to an additive constant).

waic

WAIC (up to an additive constant) on the deviance scale.

se_waic

Standard error of the WAIC.

p_eff

The effective number of parameters.

lpd

A nchain x ndocs matrix of predictive posterior likelihoods.

Value

A Model object.

Slots

ndocs

The number of documents/observations.

nchain

The number of iterations of the Gibbs sampler.

mu0

A (p + 1) x 1 matrix of prior means for eta.

sigma0

A (p + 1) x (p + 1) prior covariance matrix for eta.

eta_start

A (p + 1) x 1 matrix of starting values for eta.

eta

A nchain x (p + 1) matrix of draws of regression coefficients.

loglike

A nchain x 1 vector of the log-likelihood (up to an additive constant).

logpost

A nchain x 1 vector of the log-posterior (up to an additive constant).

waic

WAIC (up to an additive constant) on the deviance scale.

se_waic

Standard error of the WAIC.

p_eff

The effective number of parameters.

lpd

A nchain x ndocs matrix of predictive posterior likelihoods.

extra

A list of additional model fitting information. Contains time_elapsed, start_time, end_time, corrected_label_switching, and call.

Examples

1
2
m1 <- Model(ndocs = 1)
print(m1)

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