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
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
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected]
Web page: www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/pop
genetics/reph/
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
prefix
estimation commands. I'll address Roger's questions in reverse order.
Question 2
----------
Roger notes that -svy brr- doesn't currently work with -rclass-
commands:
> 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
are
> 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
update.
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:,
statsby:
> 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
a
> prefix command can access elements of returned matrix results from the
> command that has been prefixed, except for the estimates stored in
e(b)
> 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
to
> 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:
these
> commands, accessing entries of those matrices, then must I also store
> these entries in scalars, similar to the r(c_#) results returned by
the
> 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
example
using Roger's -cendif- command:
. set seed 12345
. sysuse auto
. bootstrap diff=el(r(cimat),1,2) : cendif mpg, by(for)
--Jeff
[email protected]
*
* 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/