When so many warnings, what does it in fact means? Is there a problem with the validity of the stochastic forecasting models?
I am doing a stochastic forecasting of a small population with approx. 50.000 people. I am using one year age intervals 0-90+. Because so small dataset, I am borrowing the mortality rates from a population which is similar in life expectancy. Fertility rates with 0 are replaced with 1/10000. Net migrations are calculated with the function ”netmigration” in the ”demography” package.
Then I use the function ”pop.sim” for simulating say 1.000 sample paths of population 40 years ahead.
When doing so with set.seed(505) and N=1000, I don't get any warning. But nearly all other values in set.seed and or N=1000 give me the warning messages: NAs produced.
For example when my code is
set.seed(300)
sim300 <- pop.sim(mort=mort.fcast, fert=fert.fcast, mig=mig.fcast,
firstyearpop=mort.fo,N=300, mfratio=mfratio,
bootstrap=FALSE)
The first ten messages looks like this:
Warning messages:
1: In rpois(rep(1, length(fert$age)), lambda) : NAs produced
2: In rbinom(1, B, mfratio/(1 + mfratio)) : NAs produced
3: In rpois(1, Ef0 * mort.sim$female[1, j, i]) : NAs produced
4: In rpois(1, Em0 * mort.sim$male[1, j, i]) : NAs produced
5: In rpois(rep(1, p), Ef * mort.sim$female[, j, i]) : NAs produced
6: In rpois(rep(1, p), Em * mort.sim$male[, j, i]) : NAs produced
7: In rpois(1, Ef0 * mort.sim$female[1, j, i]) : NAs produced
8: In rpois(1, Em0 * mort.sim$male[1, j, i]) : NAs produced
9: In rpois(rep(1, p), Ef * mort.sim$female[, j, i]) : NAs produced
10: In rpois(rep(1, p), Em * mort.sim$male[, j, i]) : NAs produced
How shall I interpret these messages? Does this indicate that something is wrong in the data, models, forecasting or simulation procedures?
My first guess is that, in message nr. 1, a negative value is assigned to ”lambda”?, if so, is there a way to prevent that?
The most important question is whether these NAs produced is an indicator of the validity of the models and or the forecast of the population?
Is anyone out there who can say something about what is going on here?