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

RE: st: Prefix commands and returned matrix results

From   "Newson, Roger B" <[email protected]>
To   <[email protected]>
Subject   RE: st: Prefix commands and returned matrix results
Date   Tue, 27 May 2008 20:26:44 +0100

Thanks to Jeff for clarifying these issues, and saving me a lot of work
that I might otherwise have had to do for the next update of the somersd
package. And for drawing my attention to the el() matrix function, whose
immense usefulness is not obvious at first sight. I look forward to
seeing the fix to the problems with svy brr: and jackknife: in a future
ado-file update.

And thanks again to Bob Fitzgerald for alerting me to the problem in the
first place.

Best wishes


Roger B Newson
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected] 
Web page:
Departmental Web page:

Opinions expressed are those of the author, not of the institution.

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jeff
Pitblado, StataCorp LP
Sent: 27 May 2008 18:01
To: [email protected]
Subject: Re: st: Prefix commands and returned matrix results

Roger Newson <[email protected]> asks to questions about Stata's
estimation commands.  I'll address Roger's questions in reverse order.

Question 2

Roger notes that -svy brr- doesn't currently work with -rclass-

> Another query concerns the svy brr prefix. This seems to be able to
> access only e() results, and not r() results. Is this indeed the case?
> And is it by accident or by design? And, if it is by accident, then
> there plans to fix it?

This is definitely an accident.  We have determined why -svy brr- isn't
working properly with -rclass- commands.  -svy jackknife- has a similar
problem.  Both of these commands will be fixed in a future ado-file

Question 1

Rogers first question relates to working with matrix results other than
regression coefficients and their standard errors (-_b- and -_se-):

> I have a query about Stata prefix commands (such as bootstrap:,
> and svy brr:) and returned matrix results. Based on the online help
> accessible by typing
> whelp exp_list
> there does not seem to be any way in which an expression list used by
> prefix command can access elements of returned matrix results from the
> command that has been prefixed, except for the estimates stored in
> and the standard errors extracted from the diagonal of e(V). Is this
> indeed the case? And, if you want the numeric results from a command
> be available to bootstrap:, statsby: and similar prefixes, do you have
> to return them in scalars? I ask because I have 2 commands cendif and
> censlope, which are part of the SSC package somersd, and they return
> confidence intervals for percentile slopes, differences or ratios in a
> matrix returned result r(cimat), in which the first column contains
> percents, the second column contains the estimates, and the third and
> fourth columns contain the lower and upper confidence limits,
> respectively. If I want users to be able to bootstrap: or statsby:
> commands, accessing entries of those matrices, then must I also store
> these entries in scalars, similar to the r(c_#) results returned by
> centile command in official Stata?

While -_b- and -_se- are the only syntax elements in -exp_list- for
conveniently dealing with elements from the matrices -e(b)- and -e(V)-,
Stata's -el()- matrix function can be used to pull elements from other
matrices; even other matrices in -r()- or -e()-.  Here is a simple
using Roger's -cendif- command:

	. set seed 12345
	. sysuse auto
	. bootstrap diff=el(r(cimat),1,2) : cendif mpg, by(for)

[email protected]
*   For searches and help try:

*   For searches and help try:

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