Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: copying results of fits and tables into a matrix


From   Jonathan Myles <mylesj@cancer.org.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: copying results of fits and tables into a matrix
Date   Wed, 25 Aug 2004 12:04:53 +0100 (BST)

Hello,

is it possible to copy results of fits and tables into elements of a
matrix?

so that if I have defined in a do-file

res = matrix J(2,7,0)

and I perform

                                                                                
************                                                                                
                                                                                
 xi:logit everparathesia i.study_control i.icbnpreserved,or
i.study_control   _Istudy_con_1-2     (_Istudy_con_1 for study_co~l==C
omitted)

<snip>

------------------------------------------------------------------------------
everparath~a | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+----------------------------------------------------------------
_Istudy_co~2 |   .4981238   .1389017    -2.50   0.012     .28  .86
_Iicbnpres~2 |   .8478433   .2369518    -0.59   0.555     .49  1.46
------------------------------------------------------------------------------

<dps on CIs reduced for readability>

. table everparathesia study_control icbnpreserved

------------------------------------
          |    ICBNpreserved and    
          |      study_control      
everparat | -- FALSE -    -- TRUE --
hesia     |    C     S       C     S
----------+-------------------------
        0 |   63    27      18    73
        1 |   58    14      16    28
------------------------------------


****

I can then set

mat[1,1] = 68
mat[1,2] = 27
mat[1,3] = 18
.
.
mat[2,4] = 28

and the, for example

mat [2,5] = .498 (coefficient for study_control)
mat [2,6] = .288 (lower conf. level)
mat [2,7] = .860 (upper cinf. level)

  
Thanks

Jonathan Myles
Please note my new contact details as of 2nd December 2002:

Cancer Research UK Department of Epidemiology, Mathematics and Statistics
Wolfson Institute of Preventive Medicine
Charterhouse Square
London
EC1M 6BQ

T 020 7882 6204
F 020 7882 6096
E jonathan.myles@cancer.org.uk

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index