List least likely observations

leastlikely -- List observations with lowest likelihoods

Syntax

leastlikely [varlist] [if exp]
[in range]
, [n(#) generate(varname) options allowed by list command]

Overview

For regression models for categorical dependent variables,
leastlikely lists the in-sample observations with the lowest
predicted probabilities of observing the outcome value that was
actually observed. For example, in a model with a binary dependent
variable, leastlikely lists the observations that have the lowest
predicted probability of depvar=0 among those cases for which
depvar=0, and it lists the observations that have the lowest predicted
probability of depvar=1 among those cases for which depvar=1. The
least likely values represent relatively deviant cases that may warrant
closer inspection.

leastlikely works with estimation commands for models of binary
outcomes in which option p after predict provides the predicted
probability of a positive outcome (e.g., logit, probit), but the
dependent variable must be coded as 0 and 1. Likewise, leastlikely
works with estimation commands for models of ordinal or nominal outcomes
in which option outcome(#) after predict provides the
predicted probability of outcome #. Exceptions are commands in which the
predicted probabilities are probabilities within groups or panels or for
"blocked" data; leastlikely will produce an error message if executed
after blogit, bprobit, clogit, glogit,
gprobit, nlogit, or xtlogit.

leastlikely lists the observation number and the
predicted probability (as Prob or as the variable name specified by the
generate option). Values of variables in varlist will also be
displayed.

Options

n() specifies the number of observations to be listed
for each outcome. The default is 5. If multiple observations have the same
probabilities, more than the specified number will be listed to include all
of them.

generate(varname) specifies that the probabilities
of observing the outcome value that was observed should be stored in
varname. If not specified, the variable name Prob will be created
but dropped after the output is produced.

Examples

To list least likely observations:

. logit low age lwt race2 race3 smoke ptl ht ui

. leastlikely

To list ten observations and save probabilities as variable:

. leastlikely age lwt, n(10) g(prob)