Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Richard Goldstein <richgold@ix.netcom.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: matrix problem |
Date | Wed, 15 May 2013 11:16:52 -0400 |
Roger, here is an example using the auto data: . regress mpg price foreign . predict yhat (option xb assumed; fitted values) r; t=0.00 11:15:19 . somersd mpg yhat, transf(c) Somers' D with variable: mpg Transformation: Harrell's c Valid observations: 74 Symmetric 95% CI for Harrell's c ------------------------------------------------------------------------------ | Jackknife mpg | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- yhat | .7759969 .0340637 22.78 0.000 .7092333 .8427604 ------------------------------------------------------------------------------ r; t=0.09 11:15:29 . return li scalars: r(level) = 95 matrices: r(table) : 9 x 1 r; t=0.00 11:15:35 . mat list r(table) r(table)[9,1] yhat b .77599687 se .03406367 z 22.78078 pvalue 7.11e-115 ll .70923332 ul .84276043 df . crit 1.959964 eform 0 r; t=0.00 11:15:45 . which somersd /Users/rich/Library/Application Support/Stata/ado/plus/s/somersd.ado *! Author: Roger Newson *! Date: 30 May 2012 Rich On 5/15/13 11:10 AM, Roger B. Newson wrote: > I do not recall that -somersd- (an -eclass-command) produces a matrix > result -r(table)-. What program did you use to produce -r(table)-, and > how did you do this? > > Best wishes > > Roger > > Roger B Newson BSc MSc DPhil > 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: r.newson@imperial.ac.uk > Web page: http://www.imperial.ac.uk/nhli/r.newson/ > Departmental Web page: > http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/ > > > Opinions expressed are those of the author, not of the institution. > > On 15/05/2013 16:04, Richard Goldstein wrote: >> Hi all, >> >> I am using Newson's -somersd- command (from ssc); results, including the >> piece I want, are saved in a matrix and I can list that matrix: >> >> . mat list r(table) >> >> r(table)[9,1] >> yhat1 >> b .62563699 >> se .00834334 >> t 74.986391 >> pvalue 3.73e-257 >> ll .60924043 >> ul .64203354 >> df 452 >> crit 1.9652262 >> eform 0 >> >> My problem comes in attempting to use the [1,1] term (.62563699 here); >> for example, I can't seem to list it: >> >> . matrix li r(table)[1,1] >> [ invalid name >> matrix [1,1] not found >> r(111) >> >> and I can't do what I want to do - add this value to a scalar: >> >> scalar cstat=cstat+r(table)[1,1] >> invalid syntax >> r(198) >> >> note that cstat is not the problem as it is defined (as 0) prior to >> entering my loop >> >> clearly I am doing something wrong but I have been unable to figure out >> what it is or how to fix it >> >> Rich >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/faqs/resources/statalist-faq/ >> * http://www.ats.ucla.edu/stat/stata/ >> > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ > * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/