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

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

From   Guido Heineck <>
Subject   Re: st: bootstrap error: insufficient observations ...
Date   Sun, 07 Oct 2007 19:29:05 +0200

Dear Maarten,

sorry for the late reply, but as ever thank you for your insights. I am however somewhat puzzled that the code I provided first used to work in Stata 9 (earlier this year), but not anymore in Stata 10.

Thanks again,


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

- --- Guido Heineck <> 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.

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
	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]

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 )

Hope this helps,

- -----------------------------------------
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
- -----------------------------------------
*   For searches and help try:

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