AdaptiveLogDirMRW.Rd 4.15 KB
Newer Older
1
2
3
4
5
6
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mcmc.R
\docType{class}
\name{AdaptiveLogDirMRW}
\alias{AdaptiveLogDirMRW}
\title{AdaptiveLogDirMRW}
7
8
\format{
Object of \code{\link{R6Class}} with methods for updating a \link{DirichletNode} instance.
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
}
\value{
Object of \code{\link{AdaptiveLogDirMRW}}
}
\description{
This class implements an Adaptive Multi-site logarithmic Metropolis-Hastings random walk
algorithm, constrained so the parameter vector sums to 1.
}
\details{
An adaptive multivariate log-Gaussian proposal is used for $d-1$ elements of a $d$-dimensional parameter
vector contained in \code{node}, with the $d$th element updated to ensure that the vector sums to 1.
This makes the updater useful for Dirichlet distributed random variables, improving on \link{AdaptiveDirMRW} by
ensuring proposals do not go negative.

For details of the adaptive scheme, see Roberts and Rosenthal (2012) Examples of Adaptive MCMC. \emph{Journal of Computational
and Graphical Statistics}. \bold{18}:349--367.

Please note that no checks are performed as to the suitability of this
algorithm for a particular \link{StochasticNode}.  It is up to the user
to use the correct update algorithm for the appropriate nodes.
}
30
\section{Methods}{
31

32
33
34
35
36
37
38
39
40
41
42
43
44
45
\describe{
  \item{\code{new(node, toupdate = function() 1:length(node$getData()), tune = rep(0.1, length(node$getData())), burning = 100)}}{constructor takes an instance of a \link{StochasticNode}
  node, function to choose the indices of the elements to update (by default all elements), initial tuning vector (diagonal of adaptive tuning matrix), and number of calls between
  adaptations.}
  \item{\code{update()}}{when called, updates \code{node}}
  \item{\code{acceptance()}}{return the acceptance rate}
}
}

\keyword{DAG}
\keyword{MCMC}
\keyword{node}
\section{Public fields}{
\if{html}{\out{<div class="r6-fields">}}
46
47
48
49
50
51
52
53
54
55
56
57
\describe{
\item{\code{cov}}{the current covariance}

\item{\code{burnin}}{the number of updates to burn in}

\item{\code{tune}}{the current tuning matrix}

\item{\code{naccept}}{the number of accepted proposals}

\item{\code{ncalls}}{the number of times \code{update} has been called}

\item{\code{node}}{the node to which the updater is attached}
58
59
60
61
62
63
64
}
\if{html}{\out{</div>}}
}
\section{Active bindings}{
\if{html}{\out{<div class="r6-active-bindings">}}
\describe{
\item{\code{cov}}{the current covariance}
65

66
67
68
69
\item{\code{burnin}}{the number of updates to burn in}
}
\if{html}{\out{</div>}}
}
70
\section{Methods}{
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
\subsection{Public methods}{
\itemize{
\item \href{#method-new}{\code{AdaptiveLogDirMRW$new()}}
\item \href{#method-update}{\code{AdaptiveLogDirMRW$update()}}
\item \href{#method-acceptance}{\code{AdaptiveLogDirMRW$acceptance()}}
\item \href{#method-clone}{\code{AdaptiveLogDirMRW$clone()}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-new"></a>}}
\if{latex}{\out{\hypertarget{method-new}{}}}
\subsection{Method \code{new()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{AdaptiveLogDirMRW$new(
  node,
  toupdate = function() 1:length(node$getData()),
  tune = rep(0.1, length(node$getData())),
  batchsize = 50,
  name = "name"
)}\if{html}{\out{</div>}}
}
92
93

}
94
95
96
97
98
99
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-update"></a>}}
\if{latex}{\out{\hypertarget{method-update}{}}}
\subsection{Method \code{update()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{AdaptiveLogDirMRW$update()}\if{html}{\out{</div>}}
100
}
101

102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-acceptance"></a>}}
\if{latex}{\out{\hypertarget{method-acceptance}{}}}
\subsection{Method \code{acceptance()}}{
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{AdaptiveLogDirMRW$acceptance()}\if{html}{\out{</div>}}
}

}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-clone"></a>}}
\if{latex}{\out{\hypertarget{method-clone}{}}}
\subsection{Method \code{clone()}}{
The objects of this class are cloneable with this method.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{AdaptiveLogDirMRW$clone(deep = FALSE)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{deep}}{Whether to make a deep clone.}
}
\if{html}{\out{</div>}}
}
}
}