*!1.0.1 Brent Mcsharry brent@focused-light.net 6May2018
help oeratio

Title

oeratio -- ratio of observed to expected outcomes

Syntax

oeratio
[depvar]
[if] [in]
[, options]

Main
seonly suppress the display; calculate only the standard error;
programmer's option

level(#) specify confidence level; if not specified system default is used.

by is allowed; see [D] by.

Description

oeratio calculates the ratio of the number of observed and expected outcomes.
If depvar and predictvar (the variable specifying the individual probability of a
positive outcome for each subject) are not specified, the command must follow a logit
or logistic command.

Options

Main

seonly restricts the calculation to only make calculations required to generate the
standard error and ratio of observed to expected outcomes.

level set the confidence level. If not specified, the default confidence level is
used; see [R] level.

Remarks

The variance is calculated using the Bernoulli distribution: that is if p is the prediction
variable: variance = sum(p*(1-p)). In its current form the standard error, confidence
intervals and z-score calculated do not take into account the error of the model.

When the command is used without arguments (following a logit
or logistic command) and no [if] [in] arguments are provided, only the estimation sample e(sample) is used.
If you want to use the entire data set for the calculation, not just the estimation sample, you can specify oeratio if 1. When providing the depvar variable names,
any observations in which either variable contains missing will be excluded from the calculation.

This command was developed in order to calculate the standardized mortality ratio (SMR)
for intensive care units (ICU) when applying logistic mortality prediction models such as
MPM, APACHE, PRISM or PIM models to unit data as part of benchmarking procedures.

Examples

Setup

. webuse lbw2

Logistic regression on even records

. logit low age lwt race2 race3 smoke ptl ht ui if mod(id,2)==0

Ratio of observed to expected outcomes when model applied to odd records

. oeratio if mod(id,2)==1

externally validated logistic regression model covariates applied to lbw data

. generate p = invlogit(-2 + (0.05* age))

. oeratio low p

Saved Results

oeratio saves the following in r():

Scalars

r(N) number of observations

r(predicted) number of outcomes predicted

e(obs) number of outcomes observed

e(ratio) ratio of observed to predicted outcomes

e(se) standard error

e(z) z score of the difference between observed and predicted outcome

Also see

Calculating standardised mortality rate (as opposed to ratio) [ST] stptime;