Changelog
Source:NEWS.md
bage 0.9.1
Changes to interface
- Added function
set_covariates()
. Models can now include covariates. Covariates are predictors other than the cross-classifying dimensions such as age, sex, or time – though covariates can be formed from these dimensions. - Added variables
gdp_pc_2023
anddens_2020
to datasetkor_births
. - Added
prt_deaths
dataset. - Added
set_seeds()
function, allowing users to reset random seeds (though this would be uncommon in normal use.)
bage 0.9.0
CRAN release: 2025-01-08
- From 0.9.0 onwards we will use a formal deprecation make any breaking changes
- Tweaks to printing of
"bage_mod"
objects - Started vignette replicating analyses from the book Bayesian Demographic Estimation and Forecasting
bage 0.8.6
Changes to interface
- Added
"multi"
option foroptimizer
argument tofit()
. With"multi"
, thefit()
function first triesnlminb()
and if that fails switches tooptim()
with method"BFGS"
. - Added a warning if the calculations do not converge
- Modified the printout for
"bage_mod"
objects to show the time spent byTMB::sdreport
rather than the time spent by drawing from the multivariate normal (which, since bage started using sparseMVN, is very short). - Finished vignette 1.
- Added covariates
- Added
gdp_pc_2023
anddens_2020
variables tokor_births
bage 0.8.5
Changes to internal calculations
-
report_sim()
excludes comparisons of"hyper"
parameters (eg standard deviations) if the simulation model and estimation model use different priors with different classes for that term. For instance if the simulation model uses aRW()
prior for age and the estimation model uses aRW2()
prior for age, thenreport_sim()
will not report on the standard deviation parameter for age. - Added warning to documentation for
report_sim()
stating that the interface is still under development.
bage 0.8.4
Changes to interface
- Changed
zero_sum
argument tocon
(short for “constraint”).con = "none"
corresponds tozero_sum = FALSE
, andcon = "by"
corresponds tozero_sum = TRUE
. Additional options will be added in future. - Added
sd
argument toRW()
,RW2()
,SVD_RW()
andSVD_RW2()
. The initial value of the random walks are drawn from aN(0, sd^2)
prior. By defaultsd
equals1
, but it can be set to - Loosened restrictions in
AR()
andLin_AR()
priors so that the coefficients no longer need to be consistent with stationarity. The Stan user guide recommends against building in stationarity: https://mc-stan.org/docs/stan-users-guide/time-series.html#autoregressive.section Also, testing for stationarity often causes numerical problems.
bage 0.8.2
Changes to interface
- Check to see that model object was created using current version of ‘bage’.
- Added
optimizer
argument tofit()
, giving choice between three ways of optimizing - Modifed behaviour of
quiet
argument tofit()
so that when it isTRUE
, trace output from the optimizer is shown. - Added
start_oldpar
argument tofit()
, to allow calculations to be restarted on a model that has already been fitted. - Modified printing of
"bage_mod"
object.
bage 0.8.1
Changes to interface
- Modified construction of
computations
part of models so that it works with models fitted using the “inner-outer” method. Extended theprint()
method for"bage_mod"
so that it shows extra output for models fitted using the"inner-outer"
method.
bage 0.8.0
Changes to interface
- Added ‘along’ column to tidy and print methods for
"bage_mod"
objects. (Thank you to Andrew Taylor for suggesting this.) - Allow
s = 0
inLin()
priors - Added
zero_sum
argument to priors with analong
dimension. Whenzero_sum
isTRUE
, values for each combination of aby
variable and thealong
variable are constrained to sum to zero. This can allow better identification of higher-level terms in complicated models. It can also slow computations, and has virtually no effect on estimates of the lowest-level rates, probabilities, and means. - Removed post-estimation standardization. We now rely on explicit constraints instead to give interpretable values for main effects and interactions.
- Added
RW2_Infant()
prior for modelling age-patterns of mortality rates. - The
s_seas
parameter inRW_Seas()
andRW2_Seas()
now defaults to 0, rather than 1, so that seasonal effects are by default fixed over time rather than varying. Using varying seasonal effects can greatly increase computation times. - Moved rvec from Imports to Depends, so that it loads when bage is loaded. Manipulating results from bage models without rvec loaded can lead to strange errors.
- Added information on computations to printout from fitted model objects.
- Added function
computations()
, which can be used to extract this information from fitted model objects. - Added
quiet
argument tofit()
. Whenquiet
isTRUE
(the default), warnings generated bynlminb()
are suppressed. (These warnings are virtually always about NAs early in the optimization process and are nothing to worry about.)
Changes to internal calculations
- Removed some unnecessary coercion of sparse matrices to dense matrices (which could sometimes cause memory problems)
- Added extra constraints to some priors - eg the first element of random walks is now zero. This often (but not always) helps make raw estimates of main effects and interactions more interpretable, and can speed up computations slightly.
- In the normal model, we now rescale the weights so that they have a mean of 1. This allows us to use the same default prior for dispersion (an exponential prior with mean 1), regardless of the original weights. The rescaling of the weights affects the estimated value for dispersion, but does not affect the estimates for any other parameters.
- Generation of posterior sample now using fast methods from package sparseMVN where possible.
bage 0.7.8
Datasets
- Added
HFD
, a scaled SVD object holding data from the Human Fertiltiy Database - Changed names of data objects:
-
deaths
–>isl_deaths
-
expenditure
–>nld_expenditure
-
divorces
–>nzl_divorces
-
injuries
–>nzl_injuries
-
us_acc_deaths
–>usa_deaths
-
- Added new data object
kor_births
, births in South Korea
bage 0.7.7
Bug fixes
-
report_sim()
now works on fitted models. Thank you to Ollie Pike for pointing out that it previously did not. - Removed redundant levels from
age
variable indivorces
.
bage 0.7.6
Changes to interface
- Added
newdata
argument toforecast()
. - Added minimum version numbers for rvec and poputils.
bage 0.7.5
Changes to interface
- Added arguments
method
andvars_inner
tofit()
. Whenmethod
is"standard"
(the default)fit()
uses the existing calculation methods. Whenmethod
is"inner-outer"
,fit()
uses a new, somewhat experimental calculation method that involves fitting an inner model using a subset of variables, and then an outer model using the remaining variables. With big datasets,"inner-outer"
can be faster, and use less memory, but give very similar results. - Added information on numbers of parameters, and standard deviations to output for print. Thank you to Duncan Elliot for suggesting printing numbers of parameters.
Changes to calculations
-
fit()
now internally aggregates input data before fitting, so that cells with the same combinations of predictor variables are combined. This increases speed and reduces memory usage.
bage 0.7.3
Changes to data and examples
- Modified example for
augment()
so it runs faster - Reduced size of
divorces
dataset
bage 0.7.2
Changes to interface
- Added first data model. New function is
set_datamod_outcome_rr3()
, which deals with the case where the outcome variable has been randomly rounded to base 3. -
augment()
now creates a new version of the outcome variable if (i) the outcome variable hasNA
s, or (ii) a data model is being applied to the outcome variable. The name of the new variable is created by added a.
to the start of the name of the outcome variable. - A help page summarising available data models
bage 0.7.1
Changes to interface
- There are now three choices for the
standardization
argument:"terms"
,"anova"
, and"none"
. With"terms"
, all effects, plus assoicated SVD coefficients, and trend, cyclical, and seasonal terms, are centered independently. With"anova"
, the type of standardization descibed in Section 15.6 of Gelman et al (2014) Bayesian Data Analysis, is applied to the effects.
bage 0.7.0
bage 0.6.2
Changes to interface
- Removed
SVDS()
,SVDS_AR()
,SVDS_AR1()
,SVDS_RW()
, andSVDS_RW2()
priors. Addedindep
argument to correspondingSVD
priors.SVD
priors now choose between ‘total’, ‘independent’ and ‘joint’ models based on (1) the value ofindep
argument, (2) the value ofvar_sexgender
and the name of the term.
bage 0.6.1
Changes to calculations
- Fixed problems with standardization of forecast
- Added an intercept term to
Lin()
andLinAR()
priors
bage 0.5.0
Changes to interface
- Combined interaction (eg ELin) and main effect (eg Lin) versions of priors
- Removed function
compose_time()
- Added priors RWSeas and RW2Seas
- Improved
report_sim()
bage 0.4.1
New functions
- Added ‘bage_ssvd’ method for
components()
.
Changes to interface
-
augment()
method forbage_mod
objects now calculated value for.fitted
in cases where the outcome or exposure/size is NA, rather than setting the value of.fitted
toNA
.
Internal calculations
- Standardization of effects only done if
components()
is called.augment()
uses the linear predictor (which does not need standardization.) - Internally, draws for the linear predictor, the hyper-parameters and (if included in model)
disp
are stored, rather than the full standardized components. - Standardization algorithm repeats up to 100 times, or until all residuals are less than 0.0001.
- With the new configuration, calculations for large matrices that previously failed with error message “Internal error: Final residual not 0” are now running.
bage 0.4.0
bage 0.3.2
New functions
-
forecast.bage_mod()
Forecasting. Interface not yet finalised.
bage 0.2.2
New functions
-
generate.bage_ssvd()
Generate random age-sex profiles from SVD.