Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Creating variables while bootstrapping


From   Mike Lacy <[email protected]>
To   [email protected]
Subject   st: Creating variables while bootstrapping
Date   Mon, 06 Jan 2003 17:19:38 -0700

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.

Thanks,

Mike Lacy
Fort Collins CO

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index