@@ -43,6 +43,7 @@ Contains information about the chain including a vector of accepted states
4343- `jumptypes::Vector{Int32} : vector of the attempted jumptype from the current state
4444- `α::Vector{Float32} : vector of acceptance probabilities from proposed state
4545- `accept::Vector{Bool} : vector of results from acceptance calculation
46+ - 'proposedstates::Vector{Any}' : vector of proposed states
4647
4748"""
4849mutable struct RJChain # this is the main output of RJMCMC
@@ -51,12 +52,14 @@ mutable struct RJChain #this is the main output of RJMCMC
5152 jumptypes:: Vector{Int32}
5253 α:: Vector{Float32}
5354 accept:: Vector{Bool}
55+ proposedstates:: Vector{Any}
5456end
5557RJChain(n:: Int32 )= RJChain(n,
5658Vector{Any}(undef,n),
5759zeros(Int32,n),
5860Vector{Float32}(undef,n),
5961Vector{Bool}(undef,n),
62+ Vector{Any}(undef,n)
6063)
6164function length(rjc:: RJChain )
6265 return rjc. n
@@ -69,6 +72,7 @@ function initchain(rjs::RJMCMCStruct,burninchain::RJChain) #this gets last state
6972 newchain. accept[1 ]= 1
7073 newchain. α[1 ]= 1
7174 newchain. jumptypes[1 ]= 0
75+ newchain. proposedstates[1 ]= burninchain. states[burninchain. n]
7276return newchain
7377end
7478
@@ -79,6 +83,7 @@ function initchain(rjs::RJMCMCStruct,intialstate) #this initializes new chain gi
7983 newchain. accept[1 ]= 1
8084 newchain. α[1 ]= 1
8185 newchain. jumptypes[1 ]= 0
86+ newchain. proposedstates[1 ]= intialstate
8287return newchain
8388end
8489
@@ -125,7 +130,8 @@ function runchain!(rjs::RJMCMCStruct,rjc::RJChain,iterations,mhs)
125130
126131 # get proposal
127132 mtest,vararg= rjs. proposalfuns[jt](mhs,rjc. states[nn])
128-
133+ rjc. proposedstates[nn+ 1 ]= mtest;
134+
129135 # calculate acceptance probability
130136 α= rjs. acceptfuns[jt](mhs,rjc. states[nn],mtest,vararg)
131137 rjc. α[nn+ 1 ]= α;
0 commit comments