*! version 1.0 06 February 2024

help for pretty_logistic Version 1.0 06 February 2024

Author

Georgia McRedmond & Rafael Gafoor
University College London, London UNITED KINGDOM
r.gafoor@ucl.ac.uk

Version Date Comments
1.0 06 February 2024	First release

Syntax

pretty_logistic
[if]
[in]
[,
options]

Required
predictor(varname) - grouping variable.

Optional
logtype(string) - string may be rr rd or. string specifies the coefficent to be returned.

outcomes(varlist) - specified outcome variables.

confounders(varlist) - confounding variables. fvvarlist operators can be used to specify relationships and factor/continuous variables.

reequation(string) - string may used to specify random effects following melogit syntax for random effects equations, the initial || does not need to be specified.

title(string) - title the table will be saved by. when multiple tables generated separate titles by ,

nosubheadings(string) - option to remove primary and secondary outcome titles if multiple outcomes specified.

flog(format) - specify the format of decimal points for the main coefficients.

fci(format) - specify the format of decimal points for the confidence intervals.

fp(format) - specify the format of decimal points for the probability.

Description

pretty_logistic generates publication quality tables of logistic coefficients.

pretty_logistic generates unadjusted and adjusted risk difference, risk ratio or odds ratio tables. pretty_logistic can produce up to three tables. These tables can be exported to a docx file using putdocx.
The counts and percents by the predictor variable will be produced, alongside the specified logistic coefficient, 95% confidence interval and p-value.

The default number of decimal places for the logistic coefficient, 95% confidence interval, and p-value are three decimal places. The percentage output has a default of 1 decimal place. The decimal place options can be changed for
the coefficient, the 95% confidence interval, and the p-value using the flog, fci or fp options. Guidance can be found in Stata help files for the formatting options format.

Confounders can be specified using the confounders option. Confounders can be categorical or continuous, factor and continuous confounders as well as their relationship to each other can be specified through factor-variable operators.
Guidance can be found in Stata help files for the factor-variabel operator options fvvarlist.

Random effects equations can be specified using the reequation option. Random effects are to be written in the syntax specified by melogit. The re_options from melogit can be used. The first set of || used to differentiate fixed effects equation from random effects equation are pre-included.

The default variable labels for the table are the variable labels from the dataset. Where variable labels are not specified, variable names will be presented.

The default notes for adjusted coefficents use the confounder variable labels from the dataset. Where variable labels are not specified for all confounders, variable names will be presented.

Examples

Setup

. webuse nhanes2l, clear

Basic Risk Ratio Table

. pretty_logistic, predictor(diabetes) logtype(rr) outcomes(heartatk)

Setup

. webuse nhanes2l, clear

Adjusted Odds Ratio Table

. pretty_logistic, predictor(diabetes) logtype(or) outcomes(heartatk) confounders(c.age##i.highbp) title(Table 1)

Setup

. webuse bangladesh, clear

Adjusted Risk Difference Table with Random Effects

. pretty_logistic, predictor(urban) logtype(rd) outcomes(c_use) confounders(age i.children) reequation(district:) title(Table 1)

Setup

. webuse nhanes2l, clear

Multiple Tables with Multiple Outcomes

. pretty_logistic, predictor(diabetes) logtype(or rr rd) outcomes(heartatk highbp) confounders(c.age i.female) title(Table 1, Table 2, Table 3) flog(%9.2fc)