7.4-1/2 (2023-10-17) ----- Removed rgdal from suggested packages. 7.4-0 (2023-09-14) ----- Annual subnational projections are now possible, controlled by the argument "annual" in tfr.predict.subnat(). Added use.correlation argument to tfr.predict.extra(). 7.3-1/2 (03/23/2023) ------- Citation updated. Added use.wpp.data argument to run.tfr.mcmc. 7.3-0 (02/03/2023) ----- New function for plotting maps with ggplot, called tfr.ggmap. Fixed a bug in the summary function of mcmc (thanks to Angelica Rosario Santos). Functions for resetting the medians (tfr.median.reset, tfr.median.reset.estimation) now work for all countries if the countries argument is NULL. LazyData switched off. 7.2-1/2 (12/09/2022) ----- New function for adjusting the prediction medians to WPP (tfr.shift.prediction.to.wpp). New argument in run.tfr.mcmc called use.wpp.data that can be used to avoid loading default WPP data (thanks to Marco Bressan). Bug fix in setting present year in raw tfr data (thanks to Angelica Rosario Santos). Removed infinite loops when likelihood increase is not found. 7.2-0 (10/28/2022) ----- Support for the wpp2022 package. New function get.countries.phase returns all countries and the phase they are in. Function get.countries.table now also returns the ISO character codes if the new argument iso is set to TRUE. Added argument est.uncertainty to write.projection.summary. New function for an adjustment of the estimates to WPP values (tfr.shift.estimation.to.wpp). New argument raw.outlier in run.tfr.mcmc triggers removing outliers in the raw TFR data. Bug fix in adjustments. Bug fix for handling Phase I countries when using the uncertainty feature, including in "extra" countries. Bug fix in missing the annual.simulation item in the meta object attached to prediction (thanks to Lucia Andreozzi). 7.1-1 (10/29/2021) ----- Deprecated country.code and ISO.code arguments in various functions. Argument "country" is to be used instead. This now requires import of some of the lifecycle functions. The "country" argument in many functions can now be also ISO-2 or ISO-3 characters. Various bug fixes in the functionality for extra countries. The "source" column is not required for the uncertainty feature. The column name can be passed in the "source.col.name" argument. Argument "grouping" in tfr.estimation.plot is guessed automatically if there is no "source" column. 7.0-5 (09/16/2021) ----- Fixed bug in tfr.get.dlcurves (thanks to Lucia Andreozzi). Fixed bug in tfr.raftery.diag that prevented bayesLife diagnostics from working properly (thanks to Asmida Binti Mustafa). In tfr.map.gvis, gvisGeoMap replaced with gvisGeoChart which is not based on Flash. Added reference to the description file. 7.0-4 (03/31/2021) ----- Minor fixes of publication links. 7.0-3 (03/18/2021) ----- Minor fixes needed for reverse dependencies. 7.0-2 (01/14/2021) ----- Major update: - added feature of assessing uncertainty abound the past (Liu & Raftery 2020) - added feature of estimating and projecting for annual data These changes affect the following functions: - new arguments in run.tfr.mcmc: annual, ar.phase2, uncertainty, my.tfr.raw.file, covariates, cont_covariates, iso.unbiased - new argument in tfr.predict: uncertainty - run.tfr.mcmc.extra: - now reestimates any country - new arguments: uncertainty, my.tfr.raw.file, covariates and cont_covariates, iso.unbiased - tfr.trajectories.table, tfr.trajectories.plot give uncertainty information about the past New functions: get.tfr.estimation, tfr.estimation.plot, tfr.bias.sd 6.4-0 (7/26/2019) ----- Default for wpp.year set to 2019 Restoring graphical pars in tfr.pardensity.plot, tfr.partraces.plot (thanks to Ludger Sandig for the patch) 6.3-1 (6/10/2019) ----- Removed duplicates from the include_2019 dataset. 6.3-0 (05/09/2019) ----- Support for wpp2019 (thanks to Patrick Gerland): - revision number extended - dataset include_2019 added - dataset correlation_predictors updated with additional countries Fixed bug in handling missing country pairs in correlation. 6.2-0 (10/11/2018) ----- Imputation of missing subnational values. Support for a user-defined function to modify the Phase III definition. - the function name is set in options "TFRphase3findfct" and needs arguments tfr and T_end Unit test for subnational projections. 6.1-2 (01/18/2018) ----- Bug fixes: - handling phase3 projections (phase3 countries were wrongly using world pars, since April 2017) - using data for a country not included in default tfr file had a minor bug 6.1-1 (8/9/2017) ----- Accent syntax changed in CITATION (request from CRAN). 6.1-0 (7/25/2017) ----- Support for wpp2017 added. wpp.year=2017 is the new default in run.tfr.mcmc. Note two changes in country names in wpp2017: "Czech Republic" -> "Czechia" "Other non-specified areas" -> "China, Taiwan Province of China" 6.0-0 (4/14/2017) ----- Function for subnational TFR implemented, called tfr.predict.subnat. 5.0-5 (1/5/2017) ----- Made the minimum threshold for TFR changeable via an argument (min.tfr in tfr.predict(), default is 0.5). In tfr.country.dlcurves check for country existence. 5.0-4 (11/17/2016) [CRAN] ----- Due to an issue in the CRAN check method, the following methods renamed: get.nr.countries.est became to get.nrest.countries get.data.imputed.for.country became get.data.for.country.imputed Since CRAN check cannot handle http -> https redirections, the project URL modified. 5.0-3 (11/16/2016) ----- Fixed a bug that caused run.tfr.mcmc.extra not being able to pass my.locations.file (thanks to Yicheng Li). Added functions for obtaining world and country-specific DL curves (tfr.world.dlcurves, tfr.country.dlcurves). Fixed typo in return of get.other.parameter.names (thanks to Duncan Murdoch). 5.0-2 (6/10/2016) [CRAN] ----- Modifications in tfr.map due to changes in rworldmap 1.3-6: - division of the legend colour bar put back to equal units (legendIntervals="page") - reflected change in ISO3 code for Western Sahara - no need to fix Somaliland anymore 5.0-1 (2/12/2016) [CRAN] ----- Fixed bug in writing file projection_summary_parameters.csv (column TF_time_start_decline was wrongly set to NA if supplemental values were used). 5.0-0 (12/04/2015) [CRAN] ----- Support for wpp2015 (change in imports and dependencies) The following defaults in run.tfr.mcmc changed: present.year=2015 (from 2010) wpp.year=2015 (from 2012) start.year=1950 (from 1750) Added dataset include_2015. Example directory re-created using wpp2015. DLcurve.plot got an argument "col" for modifying colors. Function tfr.get.dlcurves can be called without country, in which case it returns the "world" DL curves. 4.2-0 (7/9/2015) [CRAN] ----- MCMC outputs now also for back-transformed parameters Triangle_c1-3. Plotted trajectories are shown in a transparent color. Imports fixed to comply with the new CRAN policy. In the manual, a few citations updated. In tfr.trajectories.plot input to rgb divided by 255 (it was not working for other color than black - thanks to Patrick Gerland for finding the bug and fixing it). Bug fix in creating thinned MCMCs for extra countries. Default of b.width in run.tfr.mcmc changed to 0.05 (previous value of 0.02 caused some chains to be stuck) 4.1-0/1 (1/14/2015) [CRAN] ------ Added option of overwriting UNlocations file, i.e. easily include new countries in simulations. For this, function run.tfr.mcmc got an argument "my.locations.file". 4.0-11 (11/21/2014) [CRAN] ------ Removed usage of snow functions since CRAN doesn't like them. 4.0-10 (11/19/2014) ------ Fixed bug in imputing values. Added South Sudan to iso3166; UN code for Sudan updated. 4.0-8/9 (10/30/2014) [CRAN] ------ Removed 'require' calls. 4.0-7 (10/29/2014) ------ Accept 'name' as a column name in the tfr dataset. 4.0-6 (10/28/2014) ------ Bug fixed that caused parameters for parallel processing not being passed to continue.tfr.mcmc if iter='auto'. run.tfr3.mcmc returns NULL if no country is in phase III (before it failed with error). 4.0-4/5 (02/07/2014) [CRAN] ------- Added an option for switching the method for finding the beginning of phase II (tau_c) to the method prior version 2.0 (for reproducibility of former experiments). To turn it on, use options(TFRphase2.pre.v2=TRUE) DLcurve.plot got an argument show.legend (thanks to Guy Abel). In tfr.predict fixed a situation when after 50 iterations tfr is still falling below 0.5. 4.0-2/3 (10/9/2013) [CRAN] ----- Setting default cluster type to SOCK if not MPI or SOCK. Dependencies shuffled between Depndes and Imports. 4.0-1 (7/18/2013) [CRAN] ----- Default for wpp.year set to 2012. Package wpp2012 added to dependencies. 4.0-0 (5/23/2013) [CRAN] ----- WPP data removed and put in separate packages (wpp2008, wpp2010). The package is now dependent on those. Incorporating Bailey Fosdick's method (and code) for joint projections between countires into the tfr.predict function (argument use.correlation). Many internal changes as a result of that. Patrick Gerland's code used for: changing the projection in tfr.map function to the Robinson world projections, fixing a few UN codes (there is some mismatch in the rworldmaps codes and what the UN is using) tfr.trajectories.plot got an argument mark.estimation.points for marking points in phase II and III. 3.0-9 (4/19/2013) ----- minor internal changes in adjusting median 3.0-8 (4/5/2013) [CRAN] ----- .find.package replaced by find.package. Preliminary wpp2012 data removed (final revision to be added soon). 3.0-7 (3/17/2013) ----- Change in DLcurve.plot - points from different phases got different shape. 3.0-6 (3/16/2013) ----- DLcurve.plot can be used for countries that did not enter phase II. Observed points in DLcurve.plot now also contain points from Phase I (as empty circles). Bug in tfr.predict fixed affecting countries that did not enter phase II. 3.0-5 (3/14/2013) ----- Revision number in summary files is determined automatically from wpp.year. Fix of prediction adjustment. 3.0-4 (3/3/2013) ----- Two columns (indicatorID and sexID) added to the projection summary file. Bug in tfr.median.adjust fixed. Fixed an issue when Phase III starts before 1950. 3.0-2/3 (2/28/2013) ----- Added start.year into make.tfr.prediction. Now projections that start before (or at) 'present.year' are allowed. 3.0-1 (2/27/2013) ----- Preliminary wpp 2012 data added. Bug in tfr.plot.trajectories fixed. Bug in tfr.median.adjust fixed. 3.0-0 (2/16/2013) ----- Simulation of Phase III BHM added -> many new functions 2.1-1 (1/3/2013) ----- .First.lib and .Last.lib changed to .onLoad and .onUnload 2.1-0 (12/14/2012) ----- Added support of xz, gz, and bz compression for MCMC storage. Example data reduced to one chain. 2.0-1 (12/03/2012) ----- Disabled a few examples and tests for run-time reasons. 2.0-0 (11/30/2012) ----- Added supplemental historical time series for some countries going back to 1750. Added functionality of using historical data prior to 1950 for a subset of countries. Default of the argument start.year in run.tfr.mcmc changed to 1750. Methodology of finding start of the fertility transition changed. 1.6-0 (10/11/2012) ----- Function tfr.GoF.dl renamed to tfr.dl.coverage. Its MSE output changed to RMSE. Added MAE and cumm.CDF. Missing values can be used at the beginning of historical TFR time series. Argument 'projection.year' in all map functions changed to 'year'. A wildcard 'XXX' can be passed in the 'main' argument of all the *.all plotting functions. It is replaced by the corresponding country name. Argument 'verbose.iter' added to run.tfr.mcmc. Argument 'data.args' added to tfr.map. 1.5-1 (03/29/2012) ----- Example data reduced from three chains of 50 iterations each to two chains of 30 iterations each in order to make the package smaller. Rename coda.mcmc.list to coda.list.mcmc in order not to intervene with the S3 method coda.mcmc. Arguments typical.trajectory, col, lwd, show.legend added to tfr.trajectories.plot. Function tfr.GoF.dl added to compute goodness of fit. Argument 'predictive.distr' addedto the DLcurve.plot function to plot the double logistic curves including the error term. 1.5-0 (11/17/2011) ----- Performance improved in two ways: 1. MCMCs are converted to environments (instead of being lists), so that they are not copied every time. 2. A few functions implemented in C. 1.4-2 (10/13/2011) ----- Minor changes in get.prediction.summary.data. Internal changes in the function for plotting world maps. New function called get.countries.table added. 1.4-1 (07/15/2011) ----- Citation and reference to a JSS article added. 1.4-0 (05/06/2011) ----- Official UN WPP 2010 data added to the package and the default for argument wpp.year set to 2010. The rho and sigmaAR1 arguments of the tfr.predict function replaced by estimates based on the new data. Removed argument html.file from the function tfr.map.gvis, since the new version of the googleVis package (0.2.4) now creates html files automatically. Added item 'iter.incr' to the 'auto.conf' argument in run.tfr.mcmc, to distinguish between the length of the initial simulation and the incrementals in case it did not converge. 1.3-1 (03/15/2011) ----- Test data and locations from WPP 2010 removed. 1.3-0 (03/11/2011) ----- Lines in tfr.trajectories.plot made thicker. Allowing plotting MCMC parameters into a world-map. Allowing plotting adjusted TFRs into a world-map. Map functions can plot observed TFRs as well (in addition to projections). tfr.map and tfr.map.gvis re-written in a way that they take more advantage of the common functionality. Bug in tfr.predict.extra fixed. Summary file for MCMC parameters is written also for adjusted predictions. 1.2-6 (02/24/2011) ----- Bugs in tfr.median.adjustDL and tfr.predict.extra fixed. 1.2-5 (02/21/2011) ----- Function tfr.median.adjustDL renamed to tfr.median.adjust. Added an argument forceAR1 for controlling if countries enter Phase III in the first projection period. In tfr.trajectories.plot added an argument adjusted.only. If FALSE, both the unadjusted and adjusted medians are plotted. In write.projection.summary added an argument adjusted. If TRUE, the summary is based on adjusted projections. File names have the suffix '_adjusted'. New function for TFR maps, called tfr.map.gvis. Package googleVis added to suggested packages. Test data and locations for WPP 2010 added. 1.2-4 (02/17/2011) ----- Median adjustment of the DL predictions implemented (function tfr.median.adjustDL) 1.2-3 (02/16/2011) ----- In get.ar1.parameters: rounding removed; parameters are estimated only on countries that are included in the estimation of the world parameters. Bug in DLcurve.plot fixed causing plotting one line less than nr.curves. 1.2-2 (02/16/2011) ----- Condition for the AR1 process introduced not to fall below 0.5 (UN request). Test data removed. m1<-run.tfr.mcmc(...) and m2<-get.tfr.mcmc(...) now return results that pass the test identical(m1,m2). 1.2-1 (01/26/2011) ----- Test data and locations for WPP 2010 added. 1.2-0 (01/19/2011) ----- Function write.projection.summary now writes out a file with the model parameters. Many internal changes and small bug fixes. 1.1-1 (11/17/2010) ----- do.get.traces renamed to bdem.parameter.traces NAMESPACE modified. Bug fixed in the plotting traces function. Internal changes to allow bayesLife reusing package functionality. 1.1-0 (10/14/2010) ----- Functions tfr.median.set and tfr.median.shift for modifying the projection medians (request of the UN population division). The UN2008.txt file replaced by one whith TFRs on 4 decimal places (provided by the UN). Projection summary files are outputted also with 4 decimals. The projection_summary.csv contains also the historical data. New function: get.tfr.trajectories 1.0-0 (10/04/2010) ----- Convergence diagnostics functions re-designed. The 'auto' functionality implemented (when iter='auto' in run.tfr.mcmc and continue.tfr.mcmc). New defaults for nr.chains (3) and iter (62000) in run.tfr.mcmc. Argument thin added to tfr.predict. The tfr.predict function can use a diagnostics object to automatically determine burnin and thin (argument use.diagnostics). tfr.predict uses (or creates) an object of thinned traces. NAMESPACE created. 0.8-0 (09/07/2010) ----- Parameter 'delta' removed from the set of parameters that were analyzed on transfored scale. Function tfr.diagnose rewrote. 0.7-0 (05/17/2010) ----- Reverting the change from version 0.5-0: Parameter traces stored again in plain ASCII, due to a bug in R 2.11.0 (function gzfile does not work with the append mode) [This change is not reflected in the documentation yet.] A few internal changes that make some functions more general. 0.6-2 (05/05/2010) ----- Functions get.parameter.names and get.parameter.names.cs renamed to tfr.parameter.names and tfr.parameter.names.cs, respectively. New functions for plotting parameter density implemented, called tfr.pardensity.plot and tfr.pardensity.plot.cs. 0.6-1 (04/30/2010) ----- Bug in the fucntion tfr.predict.extra fixed. Arguments of the functions get.parameter.names and get.parameter.names.cs changed. Summary function for predictions got an extra argument 'compact' to allow for a smaller table. 0.6-0 (03/29/2010) ----- Default value for MCMC length changed to 102,000. New function for checking MCMC convergence: tfr.diagnose New class for convergence objects: bayesTFR.convergence, its getter and summary functions implemented. Prediction procedure now stores thinned traces (in predictions/thinned.mcmc) that correspond exactly to the parameter samples used for making the trajectories. Various functions can now use those traces instead of the unthinned ones in order to speed things up. Loading MCMC traces made more memory efficient. In prediction: checking if prediction directory already exists moved to the beginning of the function (before traces are loaded, since that can take lots of time). 0.5-0 (03/01/2010) ----- Prediction directory is not dependent on the end year anymore. It is stored into a subdirectory called 'predictions'. An argument 'replace.output' added to the tfr.predict function which controls if new predictions should overwrite the old ones. Parameter traces are now stored in a compressed format (with ending .gz). Function for generating maps for all projections added (called tfr.map.all). Function for displaying world maps added, called tfr.map. This functionality is dependent on the R packages rworldmap and fields which were added to the 'suggested packages'. All delta variables renamed to Triangle. sigma variables renamed to delta. This change was done in order to be consistent with the notation in the reference paper. It affects names of output files - therefore any existing simulations must be re-run. Added shape parameter for the prior Gamma distribution of sigma4. 0.4-5 (02/18/2010) ----- A bug fixed that caused country names from a user-specified TFR file to be NAs. 0.4-4 (02/03/2010) ----- my.tfr.file (passed to run.tfr.mcmc) can now contain the column 'include_code' with the following meaning: -1: do not overwrite the include_code in the location file 0: ignore 1: include in projections but not estimation 2: include in estimation and projections Except of the case of -1, these values overwrite the include_code in the location file. This option allows to include and exclude countries from the estimation without having to recompile the package. Non-standard quantiles were computed only on the set of displayed trajectories. Now they are computed on at least 2000 trajectories or all, if the total number of trajectories is less than 2000. 0.4-3 (01/24/2010) ----- All input files were converted from semicolon-separated files to tab-separated files. This impacts also the my.tfr.file format, which should be also tab-separated. Documentation: Patrick's suggestions and corrections put in. Better explanation of the my.tfr.file argument. A few test functions added into the 'test' directory (will be called automatically by the R checking procedure). Y-scaling bug (in tfr.trajectories.plot) fixed. A bug causing country names from my.tfr.file being NAs fixed. 0.4-2 (01/16/2010) ----- Country-specific prediction enabled (function tfr.predict.extra). Code cleaned-up after Leontine's review. Information added to the summary functions for both, mcmc and prediction. Documentation updated from 0.3-2 version. By default, the sigmaAR1 parameter is kept constant for all AR(1) projections. The argument allows to enter a series of sigmas for the series of projections. Thus, it does not need to be kept constant, if desired. This change allowed to remove the 'sigma.end' argument. 0.4-0 (01/02/2010) ----- Ability of running MCMC and predictions for extra countries or regions (not included in the estimation) implemented. This feature required significant refactoring of the code. New function: run.tfr.mcmc.extra. AR(1) parameters can be computed on the fly. Prediction is now made also for countries that have not start fertility transition at the last observation point. 0.3-2 (12/15/2009) ----- Bug in the prediction function fixed that caused the first imputed value to be the same as the last observed value. Argument U.width added to the run function. 0.3-1 (12/14/2009) ----- Allowing argument my.tfr.file in run.tfr.mcmc. It is a file which can include user-specified TFRs for one or more countries. Entries in tfr_matrix corresponding to those countries are replaced by the data in this file. It can also contain countries not included in the UN2008 file. In such a case, it is added to the tfr_matrix. A template file is included in the 'data' directory (my_tfr_template.csv). Imputed data (when using the 'last.observed' feature) are now clearly marked in the TFR trajectories graphs. The structure of the proposal_cov_gammas_cii data set changed. A function for computing such object added. const_sd_dummie_Tc moved from mcmc object to mcmc$meta. alpha0 parameter changed to alpha0.p and has now three values instead of one. Need for data sets Uw_c and DLpar_ini eliminated. lambda_c is now computed on the fly, therefore the data set lambda_c removed. Projection years in the summary function for a prediction changed to middle years of intervals. Additional output from tfr.raftery.diag. Minor change in coda.mcmc reflecting the thinning interval. 0.2-4 (12/08/2009) ----- Enabling different last years of observed data. The missing data are imputed using the medians from the BHM procedure. The functionality can be switched on by adding a column 'last.observed' to UN2008.csv. This column is contained in UN2008_with_last_obs.csv (in bayesTFR/data), so renaming that file to UN2008.csv would do the job (note that the set of countries in UN2008_with_last_obs.csv is not identical to UN2008.csv). The asymptotic sd in the AR(1) model is now set to 0.203 after a max of 4 projection periods. 0.2-3 (11/30/2009) ----- Bug in the function get.thinned.index fixed, which caused tfr.predict to fail for some values of the argument nr.traj. 0.2-2 (11/10/2009) ----- The convert.tfr.trajectories function also stores the trajectories in a UN-specific 'transposed' format. Function convert.trajectories renamed to convert.tfr.trajectories. Removed a condition that the minimum of tfr_matrix must be >=1 (which excluded Macao and Hong Kong) Bug fixes in tfr.gelman.diag and tfr.raftery.diag functions. Trajectories now cannot result in NA values - if an implausible value is generated, it is re-sampled. Prediction function tfr.predict accepts argument nr.traj which gives number of trajectories to be generated. 0.2-1 ----- All modifications due to the following changes in the method: 1. Delta_c4 is estimated for each country 2. Observed turnaround periods (shifts beteen DL and AR(1)) are given by lambda (the midpoint if there are two increases below 2, see report). (Note that this is now put into the R_package as a data file, but we'll probably write code to estimate it within the package.) 3. Predicted turnaround point is after the first increase after TFR gets below delta_c4 4. Distortion in start year tau has a distribution with diffferent sd than in the other years, and non-zero mean. 5. AR(1) parameters for prediction have been re-restimated based on new definition of turnaround point 0.1-6 ----- Changes in function raftery.tfr.diag (additional output). Argument mcmc.set in DLcurve.plot.all renamed to mcmc.list. Function for writing out prediction summary in a UN-specific format implemented (write.projection.summary). Parameters on which transformation is performed renamed to alphat, deltat, gammat. Modifications in functions that deal with them. Now they are handled in the same way as their not transformed counterparts. 0.1-5 ----- Setting RNG seed enabled. Functions for exporting trajectories from binary format to UN-specific ascii format. Arguments to control the number of such trajectories added. Modifications for enabling different last years of observed data (not finished yet). Legend's color in trajectories plot fixed. More documentation. Bug in function country.names fixed. 0.1-4 ----- More documentaiton. For better disk usage, the variables 'eps_Tc', 'const_sd_dummie_Tc', and 'add_to_sd_Tc' are not stored into disk, since they can be recomputed when needed. An option to plot/tabulate the half-child variant added. Functions for plotting TFR trajectories and DL curves for ALL countries written (tfr.trajectories.plot.all, DLcurve.plot.all). Plotting functions for trajectories and DL curve accept additional graphical parameters. Files with country-specific parameters and trajectories have now the country code as postfix, instead of country index.