@@ -194,37 +194,20 @@ end
194
194
"""
195
195
is_symmetric_proposal(proposal)
196
196
197
- # Example:
198
-
199
- ```julia
200
- using Distributions, AdvancedMH
201
-
202
- # Model definition.
203
- model = DensityModel(s -> logpdf(Normal(), s.x) + logpdf(Normal(5,.7), s.y))
204
-
205
- # Set up the proposal.
206
- p = (x=RandomWalkProposal(Normal(0,.5)), y=RandomWalkProposal(Normal(0,.5)))
207
-
208
- # Implementing this will skip the computation of the Hastings ratio.
209
- AdvancedMH.is_symmetric_proposal(proposal::typeof(p)) = true
210
-
211
- # Sample from the posterior with initial parameters.
212
- chain = sample(m1, MetropolisHastings(p), 100000; chain_type=Vector{NamedTuple})
213
- ```
214
197
"""
215
- is_symmetric_proposal (proposal:: P ) where P = false
198
+ is_symmetric_proposal (proposal) = false
216
199
217
200
# The following univariate random walk proposals are symmetric.
218
- is_symmetric_proposal (proposal :: RandomWalkProposal{<:Normal} ) = true
219
- is_symmetric_proposal (proposal :: RandomWalkProposal{<:MvNormal} ) = true
220
- is_symmetric_proposal (proposal :: RandomWalkProposal{<:TDist} ) = true
221
- is_symmetric_proposal (proposal :: RandomWalkProposal{<:Cauchy} ) = true
201
+ is_symmetric_proposal (:: RandomWalkProposal{<:Normal} ) = true
202
+ is_symmetric_proposal (:: RandomWalkProposal{<:MvNormal} ) = true
203
+ is_symmetric_proposal (:: RandomWalkProposal{<:TDist} ) = true
204
+ is_symmetric_proposal (:: RandomWalkProposal{<:Cauchy} ) = true
222
205
223
206
# The following multivariate random walk proposals are symmetric.
224
- is_symmetric_proposal (proposal :: RandomWalkProposal{AbstractArray{<:Normal}} ) = true
225
- is_symmetric_proposal (proposal :: RandomWalkProposal{AbstractArray{<:MvNormal}} ) = true
226
- is_symmetric_proposal (proposal :: RandomWalkProposal{AbstractArray{<:TDist}} ) = true
227
- is_symmetric_proposal (proposal :: RandomWalkProposal{AbstractArray{<:Cauchy}} ) = true
207
+ is_symmetric_proposal (:: RandomWalkProposal{<: AbstractArray{<:Normal}} ) = true
208
+ is_symmetric_proposal (:: RandomWalkProposal{<: AbstractArray{<:MvNormal}} ) = true
209
+ is_symmetric_proposal (:: RandomWalkProposal{<: AbstractArray{<:TDist}} ) = true
210
+ is_symmetric_proposal (:: RandomWalkProposal{<: AbstractArray{<:Cauchy}} ) = true
228
211
229
212
# Define the other sampling steps.
230
213
# Return a 2-tuple consisting of the next sample and the the next state.
0 commit comments