PDF Reports
Standardized PDF reports can be generated from analysis results. These combine all the plots described in the Plotting section of the manual into a single standalone PDF document along with several tables. Reports can be generated for both Pumas and NCA results. Report generation is accessed via the report function.
Pumas
For Pumas fitted models we can generate reports with equivalent content to that which is presented in the evaluate_diagnostics interactive application using the same input syntax for the fitted models. Please see the section of supported syntax for evaluate_diagnostics.
The report function discussed in this section only supports continuous data models. Support for discrete data models will be made available soon.
For a single model report based on a fitted model called my_fitted_model we can use the following:
report(my_fitted_model)Once the above report call returns you will find in the output folder a PDF report containing the following sections:
- a cover page
- table of contents
- list of figures
- list of tables
For each fitted model the following is also included:
- listing of metadata associated
latexifyoutput for each block in the model- metric and coefficient tables
- data checkout plots for the populations
- goodness-of-fit plots
- visual predictive check plots if any VPCs are provided
- distribution plots
- convergence trace plots
- tables of individual coefficients
- complete printout of logged output from fitting
- details of the
Manifest.tomlassociated with the active Julia project
Pumas Customization
The following attributes can be customized on a per-report basis. Each one is provided as a keyword argument to report:
PlottingUtilities.report — Functionreport(
fitted_models;
output,
title,
version,
date,
author,
categorical,
force,
inspect,
infer,
clean,
header,
footer,
plot_fontsize,
plot_resolution
)
Create a PDF report based on the provided fitted_models.
fitted_models can be provided as one of several different inputs:
A single fitted model result from fit.
fit_result = fit(...)
report(fit_result)Note that ... in these examples is not real syntax and is used in these examples to illustrate unimportant details.
A vector of fitted model results from fit.
fit_1 = fit(...)
fit_2 = fit(...)
report([fit_1, fit_2])The above two calls will result in fitted models named 1 to N. If you wish to provide named fitted models in the resulting report then pass in a NamedTuple instead of a single fit result or vector:
my_named_fit = fit(...)
report((; my_named_fit))fit_1 = fit(...)
fit_2 = fit(...)
report((; fit_1, fit_2))Note the leading ;, which is standard Julia syntax and required for naming your fitted models.
Other computed results can also be included alongside your fit results, namely inspect, infer, and vpc results. Any number of vpc results can be included, while only one of each of inspect and infer may be included. To include associated results along with the fitted model use Julia's tuple syntax, i.e. (a, b, c):
fit_1 = fit(...)
ins_1 = inspect(fit_1, ...)
inf_1 = infer(fit_1, ...)
vpc_1 = vpc(fit_1, ...)
vpc_2 = vpc(fit_1, ...)
report((; my_model = (fit_1, ins_1, inf_1, vpc_1, vpc_2)))Keywords
output: directory into which the final report files will be saved.title: a title for the final report that will appear on the title page and be used for the name of the finished PDF.version: the version of the document, given as av"..."string.date: the date of the report, given as aDatevalue.author: the name of the author of the document.categorical: a vector ofSymbols for covariates that should be treated as categorical in all plots of the report.force: (defaulttrue) remove all contents ofoutput(if it exists) before generating a new report.inspect: (defaulttrue) shouldinspectbe called automatically on fitted models if noinspectresult is already provided. The call toinspectdoes not pass any additional arguments and so if customizedinspectcalls are required, for example when using NPDE, a pre-computedinspectresult should be passed in instead of relying of the automatic behaviour.infer: (defaultfalse) shouldinferbe called automatically on fitted models if noinferresult is already provided.clean: (defaulttrue) only include the final PDF document in theoutputfolder rather than all intermediate files as well.header: custom text to be added to the header section of each page.footer: custom text to be added to the footer section of each page.plot_fontsize: set the font size for all plots in the report. Default is16.plot_resolution: set the resolution for all plots in the report. Default is(960, 540).
Examples
The following will generate a report based on objects fpm1 and fpm2, which are FittedPumasModels. It will automatically call inspect for each.
report((; fpm1, fpm2))The names of the models in the reports will be the same as the variable names. To change the names pass a different key name in the NamedTuple syntax passed to report.
Report-level metadata that should be included in the generated report can be passed in via the keyword arguments title and version, others to be added later.
The name of the resulting PDF file can be given with output = "NAME.pdf.
report(figures::Vector{Figure})Create a report document containing all the figures in figures provided in figures.
Keywords
outputthe directory in which the final document is saved.titlerequired, the title of the document.authorthe author of the document.headercontents of the page headers.footercontents of the page footers.captioncaption to use for each figure.forcereplace theoutputdirectory if it exists.cleanonly save the final document, not intermediate files.landscapeuse landscape orientation for the figures in the document.logopath to a png or svg file used at the bottom of the front page.logo_width_ptwidth inptof the logo on the bottom of the front page.
NCA
For NCA we can generate reports for NCAPopulation and NCAReport data. The following input variations are supported for report for NCA. ... syntax here is not legal Julia syntax and is only used to represent details unimportant to the given examples.
Generate a report using all defaults from a run_nca result:
nca_report = run_nca(...)
report(nca_report)A report using a customized summarize rather than the default:
nca_report = run_nca(...)
nca_summary = summarize(...)
report(nca_report, nca_summary)Or by using a NCAPopulation directly and specifying all the required keywords directly to report rather than the intermediate run_nca and summarize functions.
report(
nca_population;
parameters = ...,
stratify_by = ...,
studytitle = ...,
sigdigits = ...,
)Once the report call has finished you will find in the output/ folder a PDF report containing the following sections:
- a cover page
- table of contents
- list of figures
- list of tables
- report metadata passing in via keywords or the
NCAReportobject - a table of summary statistics
- linear and log plots of observations summary
- individual subject fit plots in linear and log scale
Customization
The following attributes can be customized on a per-report basis. Each one is provided as a keyword argument to report. In addition to the keywords provided in run_nca and summarize, report for NCAPopulation and NCAReport also supports the following keywords.
output::Stringspecifies the folder, relative to the currently active directory, into which the resulting PDF report should be saved. If this folder already exists then it will be overwritten. Useforce=falseto disable this behavior.force::Boolis used to either overwrite (true) theoutputfolder prior to generating a new report, or to throw an error (false). The default istrue, set tofalseif you do not want to automatically overwrite theoutputfolder.clean::Boolcontrols whether to only save the final PDF report tooutput, or to include all intermediate files as well. Set toclean = falseif you would like to not clean theoutputfolder. Defaults totrue.header::Stringandfooter::Stringcan be used to add customized headers and footers to every page of the report aside from the title page.
Pumas
The report function discussed in this section only supports continuous data models. Support for discrete data models will be made available soon.
For a single model report based on a fitted model called my_fitted_model we can use the following:
report(my_fitted_model)Once the above report call returns you will find in the output folder a PDF report containing the following sections:
- a cover page
- table of contents
- list of figures
- list of tables
For each fitted model the following is also included:
- listing of metadata associated
latexifyoutput for each block in the model- metric and coefficient tables
- data checkout plots for the populations
- goodness-of-fit plots
- visual predictive check plots if any
VPCs are provided - distribution plots
- convergence trace plots
- tables of individual coefficients
- complete printout of logged output from fitting
- details of the
Manifest.tomlassociated with the active Julia project
Customization
The following attributes can be customized on a per-report basis. Each one is provided as a keyword argument to report.
output::Stringspecifies the folder, relative to the currently active directory, into which the resulting PDF report should be saved. If this folder already exists then it will be overwritten. Useforce = falseto disable this behavior.title::Stringspecifies the report title to be used for both the title page of the document and the name of the final PDF file.version::VersionNumbercan be used to embed a version number of the metadata section of the PDF document.date::Dates.Datespecifies the date to be used on the title page of the document. It will default to the current date if not provided.author::Stringallows the author name of the report to be included on the title page.categorical::Vector{Symbol}a vector of covariate names in the fitted models that should be treated as categorical when generating plots.force::Boolis used to either overwrite (true) theoutputfolder prior to generating a new report, or to throw an error (false). The default istrue, set tofalseif you do not want to automatically overwrite theoutputfolder.inspect::Boolcan be used to control whetherPumas.inspectis called on each fitted model if noPumas.inspectresult can be found in the provided inputs. This defaults totrue.infer::Boolcan be used to control whetherPumas.inferis called on each fitted model if noPumas.inferresult can be found in the provided inputs. This defaults tofalse.clean::Boolcontrols whether to only save the final PDF report tooutput, or to include all intermediate files as well. Set toclean = falseif you would like to not clean theoutputfolder. Defaults totrue.header::Stringandfooter::Stringcan be used to add customized headers and footers to every page of the report aside from the title page.
PlottingUtilities.report — Functionreport(
fitted_models;
output,
title,
version,
date,
author,
categorical,
force,
inspect,
infer,
clean,
header,
footer,
plot_fontsize,
plot_resolution
)
Create a PDF report based on the provided fitted_models.
fitted_models can be provided as one of several different inputs:
A single fitted model result from fit.
fit_result = fit(...)
report(fit_result)Note that ... in these examples is not real syntax and is used in these examples to illustrate unimportant details.
A vector of fitted model results from fit.
fit_1 = fit(...)
fit_2 = fit(...)
report([fit_1, fit_2])The above two calls will result in fitted models named 1 to N. If you wish to provide named fitted models in the resulting report then pass in a NamedTuple instead of a single fit result or vector:
my_named_fit = fit(...)
report((; my_named_fit))fit_1 = fit(...)
fit_2 = fit(...)
report((; fit_1, fit_2))Note the leading ;, which is standard Julia syntax and required for naming your fitted models.
Other computed results can also be included alongside your fit results, namely inspect, infer, and vpc results. Any number of vpc results can be included, while only one of each of inspect and infer may be included. To include associated results along with the fitted model use Julia's tuple syntax, i.e. (a, b, c):
fit_1 = fit(...)
ins_1 = inspect(fit_1, ...)
inf_1 = infer(fit_1, ...)
vpc_1 = vpc(fit_1, ...)
vpc_2 = vpc(fit_1, ...)
report((; my_model = (fit_1, ins_1, inf_1, vpc_1, vpc_2)))Keywords
output: directory into which the final report files will be saved.title: a title for the final report that will appear on the title page and be used for the name of the finished PDF.version: the version of the document, given as av"..."string.date: the date of the report, given as aDatevalue.author: the name of the author of the document.categorical: a vector ofSymbols for covariates that should be treated as categorical in all plots of the report.force: (defaulttrue) remove all contents ofoutput(if it exists) before generating a new report.inspect: (defaulttrue) shouldinspectbe called automatically on fitted models if noinspectresult is already provided. The call toinspectdoes not pass any additional arguments and so if customizedinspectcalls are required, for example when using NPDE, a pre-computedinspectresult should be passed in instead of relying of the automatic behaviour.infer: (defaultfalse) shouldinferbe called automatically on fitted models if noinferresult is already provided.clean: (defaulttrue) only include the final PDF document in theoutputfolder rather than all intermediate files as well.header: custom text to be added to the header section of each page.footer: custom text to be added to the footer section of each page.plot_fontsize: set the font size for all plots in the report. Default is16.plot_resolution: set the resolution for all plots in the report. Default is(960, 540).
Examples
The following will generate a report based on objects fpm1 and fpm2, which are FittedPumasModels. It will automatically call inspect for each.
report((; fpm1, fpm2))The names of the models in the reports will be the same as the variable names. To change the names pass a different key name in the NamedTuple syntax passed to report.
Report-level metadata that should be included in the generated report can be passed in via the keyword arguments title and version, others to be added later.
The name of the resulting PDF file can be given with output = "NAME.pdf.
report(figures::Vector{Figure})Create a report document containing all the figures in figures provided in figures.
Keywords
outputthe directory in which the final document is saved.titlerequired, the title of the document.authorthe author of the document.headercontents of the page headers.footercontents of the page footers.captioncaption to use for each figure.forcereplace theoutputdirectory if it exists.cleanonly save the final document, not intermediate files.landscapeuse landscape orientation for the figures in the document.logopath to a png or svg file used at the bottom of the front page.logo_width_ptwidth inptof the logo on the bottom of the front page.
Further Customization
The report function leverages the Publish package for creation of the final PDF reports. Creation of completely customized reports (ones that cannot be achieved with the options outlined in the last section) falls outside the scope of report. Please refer directly to the Publish documentation should you wish to write more bespoke documents.