cbreto / panelPomp

R package for statistical inference using panelPOMPs (panel Partially Observed Markov Processes)
11 stars 6 forks source link

Example of mif2 with the prw example? #28

Closed sdwfrost closed 5 years ago

sdwfrost commented 5 years ago

Hi @cbreto! I'm trying to run the panel random walk example, prw, along the lines of the SBIED code here for a different model. I can use pfilter, but I can't get mif2 to work. The following gives an error:

mif2(prw,Nmif=2,Np=200,cooling.fraction.50=0.1,rw.sd=rw.sd(sigmaX=0.1,sigmaY=0.1))
Error: in ‘mif2’: pomp's ‘mif2’ error message: in ‘mif2’: 'arg' must be of length 1 (panelPomp:::mif2.internal)

Any suggestions on how to get this working?

cbreto commented 5 years ago

Hi @sdwfrost-- it'll work if a cooling.type argument (either 'geometric' or 'hyperbolic') is given to panelPomp::mif2.

library(panelPomp)
prw <- panelPompExample("prw")
# error
mif2(prw,Nmif=2,Np=200,cooling.fraction.50=0.1,rw.sd=rw.sd(sigmaX=0.1,sigmaY=0.1))
# works
mif2(prw,Nmif=2,Np=200,cooling.fraction.50=0.1,rw.sd=rw.sd(sigmaX=0.1,sigmaY=0.1),
  cooling.type="geometric")

cooling.type used to be 'hyperbolic' by default (see ?`mif2,panelPomp-method`). However, this seems to no longer be the case, most likely due to a change in pomp (kingaa/pomp@7c68509c0e2f9a7f27b5c7779b6e03868adf3e9f, which removed a call to match.arg on which panelPomp appears to have relied to set its own default cooling type). I should be able to fix this soon. In the meantime, please consider simply including the cooling.type argument.

sdwfrost commented 5 years ago

Thanks @cbreto! I'm glad it was a simple fix. I like the pomp2 API better, but it breaks a whole bunch of examples...