Dear Mike,
It will be sufficient to type
predict p1-p`e(k_cat)'
If you need to create the local macro with the list of variables before
creating the vbles
for other purpose, you can type
foreach num of numlist 1(1)`e(k_cat)' {
local PList "`PList' p`num'"
}
If you have already created the vbles, you can always use the unab command.
unab PList: p1-p`e(k_cat)'
Regards,
Marcela
----- Original Message -----
From: "Mike Lacy" <[email protected]>
To: <[email protected]>
Sent: Monday, January 06, 2003 9:19 PM
Subject: st: Creating variables while bootstrapping
> 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/
>
*
* 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/