错误: in ‘mif2’: ‘dmeasure’ with log=TRUE returns illegal value #222
Replies: 6 comments 3 replies
-
This is the data used: |
Beta Was this translation helpful? Give feedback.
-
Your transformation functions are not inverse to one another. For example, if you have
in the snippet that implements transformation to the estimation scale, then you would want
in the snippet that transforms back onto the model scale. See the manual. P.S. I'm surprised the code that you've furnished runs at all. You must be using a very old version of the package. Why is that? |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for your reply! The version of "pomp" that I am using is 5.6. Unfortunately, even after making the changes to the code as you suggested, I am still not getting the correct results. The modified code is as follows:
The error message is:
|
Beta Was this translation helpful? Give feedback.
-
You were not passing the parameter transformations properly: like all arguments to Also, the code you were running looks like it has been lifted with minimal changes from code designed to work under a very old version of the package. In particular, the I've had a pretty thorough look at your code, which you haven't tried to explain, but it seems familiar enough to me that I can guess something about what you are trying to do. I've made quite a number of corrections, some of which are based on this kind of informed speculation. So read the following carefully. In particular, I don't think your You'll also note that I've changed the style of the code: good style makes code easier to read and also less prone to errors. Running this under pomp v 5.11, I can now see that your model assumptions are problematic. In particular, for allowable values of the parameters, you can have negative values of the state variables, which are incompatible with the data. This happens because there is nothing stopping you removing more individuals from a compartment than are in the compartment. Have a look at FAQ 3.6. It is not necessary to use the Euler-multinomial approximation, but you need to do so something to make sure that your compartment occupancy variables do not go negative.
|
Beta Was this translation helpful? Give feedback.
-
As a simple example of what I'm talking about, here's something I knocked up:
|
Beta Was this translation helpful? Give feedback.
-
This |
Beta Was this translation helpful? Give feedback.
-
Thank you for your time at first!
I'm trying to estimate parameters in a epidemic model via the mif2 algorithm. Unfortunately there is often an error message that the dmeasure returns non-finite values during the mif2 process. I found that one of the state variables “cases” is negative by using the Rprintf statement, and the parameter “rho” related to this state is also negative, but I have set the parameter “rho” to be finite (0.0.1). I don't know why this happens.The code and data are:
Beta Was this translation helpful? Give feedback.
All reactions