You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this case the firstyearpop is medio 2007, and the first forecasted year have the dimname = 2007, it does not make sense to me, it should be 2008. Am I right or wrong?
I made a forecast 40 year a head. While comparing forecasted population with dimname = 2007, with actual population 2007, it does not fit at all, but fit perfectly with actual population 2008. Dimname 2016 fit also very well with actual population 2017.
What about changing pop.sim function to something like this:
at the very end of the pop.sim function, line number 153 and 154 it says:
When forecasting population with pop.sim in demography package, I find the dimnames in output confusing.
Here is my example:
library("demography")
mort.fo <- read.demogdata(file = "data/mort_no.txt", popfile = "data/pop_fo.txt", type = "mortality", label = "Føroyar", skip = 0)
mort.fo <- extract.years(mort.fo, 1985:2007)
fert.fo <- read.demogdata(file = "data/fert_rate.txt", popfile = "data/pop_fert.txt", type = "fertility", label = "Føroyar", skip = 0, lambda = 0.4)
fert.fo <- extract.years(fert.fo, 1985:2007)
mort.sm <- smooth.demogdata(extract.years(mort.fo, 1985:2006))
fert.sm <- smooth.demogdata(extract.years(fert.fo, 1985:2006))
mig.fo <- netmigration(mort.fo, fert.fo)
mort.fit <- coherentfdm(mort.sm)
fert.fit <- fdm(fert.sm)
mig.fit <- coherentfdm(mig.fo)
mort.fcast <- forecast(mort.fit, h = 40, level = 95)
fert.fcast <- forecast(fert.fit, h = 40, level = 95)
mig.fcast <- forecast(mig.fit, h = 40, level = 95)
set.seed(27052018) # dagfesting fyri fyrstu simulering
sim10000 <- pop.sim(mort = mort.fcast, fert = fert.fcast, mig = mig.fcast, firstyearpop = mort.fo, N = 10000, mfratio = 1.05, bootstrap = T)
Output
In this case the firstyearpop is medio 2007, and the first forecasted year have the dimname = 2007, it does not make sense to me, it should be 2008. Am I right or wrong?
I made a forecast 40 year a head. While comparing forecasted population with dimname = 2007, with actual population 2007, it does not fit at all, but fit perfectly with actual population 2008. Dimname 2016 fit also very well with actual population 2017.
What about changing pop.sim function to something like this:
at the very end of the pop.sim function, line number 153 and 154 it says:
dimnames(pop.m)[[2]] <- dimnames(pop.m)[[2]] <- firstyr +
(1:h) - 1
return(list(male = pop.m, female = pop.f))
}
Changed to:
dimnames(pop.m)[[2]] <- dimnames(pop.f)[[2]] <- firstyr +
(1:h)
return(list(male = pop.m, female = pop.f))
}
What do you think?
The text was updated successfully, but these errors were encountered: