I'm bootstrapping a non-standard statistic that requires running PREDICT
after OLOGIT on each bootstrapped sample. I'm having trouble having the
right number of variables to contain the predicted probabilities. Here's
what's happening:
I capture the predicted probabilities in a list of variables defined in a
local statement at the beginning of the program. So, let's suppose I
have a four-category response variable. I have a local statement like
local PList "p1 p2 p3 p4"
I then later do
ologit blah blah
predict `PList'
The problem I'm encountering occurs when one of the categories of the
response variable do not happen to occur in a given bootstrap sample. For
that sample, suppose that only categories 1, 3, and 4 have nonzero
frequencies, so that there would be only three predicted probabilities for
the response. This makes PREDICT fail because PList has too many variables.
I know I can obtain the number of actually occurring values of the response
variable from e(k_cat) after OLOGIT.
What I'm looking for is a way to construct a
variable list of the form "p1 p2...p_k" that is only as long as the value
of e(k_cat) for this sample, so I can do
PREDICT .... with the right number of variables.