Closed bogaotory closed 4 years ago
Not sure why you think there's a typo. The code matches the text description, no?
You get the parameter value at the last mif2
iteration using coef
.
For b
, firstly I'm not quite sure if b=ifelse(0.2, time==time[1], 0)
is a correct ifelse
expression? Secondly, in the text b
and c
are equivalent as in "parameter b and c both get perturbations of s.d. 0.2 only before the first observation". Therefore I think the correct expression is b=ifelse(time<=time[1], 0.2, 0)
(small correction from my first message)
For d
, I actually think the text is wrong too because you have e=ivp(0.2, lag=13)
which syntax-wise has no error. But that means for e
the first 13 observations had no perturbation. This contradicts your text which says "Parameters d and e, by contrast, get perturbations of s.d. 0.2 only before the thirteenth observation." What I think you meant is that the perturbation of s.d. 0.2 start only after the thirteenth observation. Which leads me to think that the correct expression for d
is d=ifelse(time>=time[13], 0.2,0)
coef
gives the values at the end of the iteration. I wondered if there is a way to extract the time series like those in the diagnostics plots? But I can use print
to get around this for debugging purposes.
@bogaotory:
For
b
, firstly I'm not quite sure ifb=ifelse(0.2, time==time[1], 0)
is a correctifelse
expression?
Whoops, yes, you are right.
Secondly, in the text
b
andc
are equivalent as in "parameter b and c both get perturbations of s.d. 0.2 only before the first observation". Therefore I think the correct expression isb=ifelse(time<=time[1], 0.2, 0)
(small correction from my first message)
Perhaps I should say "only just before".
For
d
, I actually think the text is wrong too because you havee=ivp(0.2, lag=13)
which syntax-wise has no error. But that means fore
the first 13 observations had no perturbation. This contradicts your text which says "Parameters d and e, by contrast, get perturbations of s.d. 0.2 only before the thirteenth observation." What I think you meant is that the perturbation of s.d. 0.2 start only after the thirteenth observation. Which leads me to think that the correct expression ford
isd=ifelse(time>=time[13], 0.2,0)
You misunderstand: ivp(0.2,lag=13)
causes the perturbation to be applied only once, just before the observation at time[13]
. If you wanted perturbations to begin at that time and continue afterward, your expression would do that.
coef
gives the values at the end of the iteration. I wondered if there is a way to extract the time series like those in the diagnostics plots? But I can use
Yes. Use traces
. This gives particle movements against IF2 iteration.
If you want the particles' movements against time, I don't think there is currently a way of doing that.
For
d
, I actually think the text is wrong too because you havee=ivp(0.2, lag=13)
which syntax-wise has no error. But that means fore
the first 13 observations had no perturbation. This contradicts your text which says "Parameters d and e, by contrast, get perturbations of s.d. 0.2 only before the thirteenth observation." What I think you meant is that the perturbation of s.d. 0.2 start only after the thirteenth observation. Which leads me to think that the correct expression ford
isd=ifelse(time>=time[13], 0.2,0)
You misunderstand:
ivp(0.2,lag=13)
causes the perturbation to be applied only once, just before the observation attime[13]
. If you wanted perturbations to begin at that time and continue afterward, your expression would do that.Ah, I see. That makes sense since
ivp(0)
simply keeps the parameter at the initial guess. Somehow I didn't make that connection in my head. Great, thanks very much for your help!
And thanks for reporting the typo. It's fixed in the release going out in a few minutes.
https://github.com/kingaa/pomp/blob/344ecc2230eff9722cb6fe905a6ed77a9045ec05/manual/mif2.html#L207-L211
I wonder if there are a couple of typos here for
b
andd
the correct versions should be:Also, I wonder if there is a way to extract the parameter value over time in the last iteration? Similar to the way
eff.sample size
andcond.logLik
can be applied tomif2
to get trace of the last iteration for the diagnostics plot. Thank you