Mortality analysis in Julia using LifeTable and mortchartgen data.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Build Status

This package can be used to perform statistical analysis on mortality data generated from the mortchartgen scripts. It implements some functionality in specchartgen.r and in a more general manner using the functions defined in the LifeTable package.

The MortParamsPlot module exports the following functions:

  • LongTable(indbfile = joinpath(mgendir, "chartgen.db")) -- Converts the tables in the SQLite database indbfile from wide to long format. The function returns a dictionary with the tables in long format.
  • FitFrames(indict, sex, ages, ageformat, dimension, cause, country, year) -- Takes a dictionary returned by LongTable and selects a subset of rows given by the other parameters, where ages is a vector of integers, ageformat is used to select relevant columns from the original data, and the values of sex, cause, country and year can be anything defined in chartgen.yaml. The query result is then transposed by the column given by dimension.
  • FitParams(indict, func, functype) -- If indict is an array of dictionaries returned by FitFrames, the first dictionary is assumed to contain data for cause-specific mortality and the second data for total mortality, so that the analysis is normalized to the proportion of the population dying of the cause in question. If indict is a single dictionary, analysis is performed without this normalization (this should always be used to fit total mortality, since normalizing obviously would be redundant in this case). If func = "weibull", data are fitted to a two-parameter Weibull function; if func = "gompertz", data are fitted to a Gompertz function. If functype = "rate", age-specific mortality rates are fitted; if functype = "surv", age-specific survival probabilites are fitted.
  • ParamsPlot(fitdict, plot = "params") -- Takes a dictionary returned by FitParams or FitParamsNonnorm. If plot = "params", a scatterplot showing correlations between linearized versions of the estimated parameters for the survival or mortality functions is drawn. If plot = "trend" and indict is grouped by years, a time trend of the X parameter is plotted.
  • ObspredPlot(fitdict, points, ages, trans = "none", trans_time_coords = false, trans_y_coords = false) -- Takes a dictionary returned by FitParams or FitParamsNonnorm and plots observed values for the data points (years, causes or countries) given by points against predicted values for these points for the ages given by ages. If trans = "gomp_lin, the data is transformed so that the plotted curves are linear if the data fits a Gompertz function. If trans = "weib_lin, the data is transformed so that the plotted curves are linear if the data fits a Weibull function. If trans_time_coords = true, the time coordinates along the X axis are transformed according to the given transformation. If trans_y_coords = true, this is done with the Y axis coordinates.