Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: bootstrap error: insufficient observations ...


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: bootstrap error: insufficient observations ...
Date   Mon, 1 Oct 2007 10:44:50 +0100 (BST)

--- Guido Heineck <[email protected]> wrote:
> I run a multinomial logit model and want to examine differences in 
> predicted probabilities for different hypothetical groups of my
> sample. Using the auto-data, the following code shows what I do.

<snip>

> I tried several things, but so far I was not successful. I would thus
> appreciate any helpful hint.

Try the following example:

*------------ example -------------------------
set more off

sysuse auto, clear
xtile lhs = price, nq(4)
gen forXmpg = foreign * mpg

capture program drop bst
program bst, rclass
	mlogit lhs foreign mpg forXmpg
	preserve
	drop _all
	set obs 4
	gen foreign = _n <= 2
	gen mpg = cond(mod(_n,2),11,22)
	gen forXmpg = foreign * mpg
	predict pr*, pr
	return scalar diff11 = pr1[1]-pr1[3]
	return scalar diff13 = pr3[1]-pr3[3]
	return scalar diff21 = pr1[2]-pr1[4]
	return scalar diff23 = pr3[2]-pr3[4]
	restore
end	

tempfile res
bootstrap diff11=r(diff11) diff13=r(diff13)  /*
       */ diff21=r(diff21) diff23=r(diff23), /*
       */ reps(100) saving(`res') seed(999): bst
use `res', replace
*------------ end example -------------------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

Hope this helps,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      ___________________________________________________________ 
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good  http://uk.promotions.yahoo.com/forgood/environment.html
*
*   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