Skip to content

summary.formula: method reverse does not use fun argument

4 messages · Thomas Gerds, Frank E Harrell Jr, Thomas Lumley

#
hi,

recently i discovered the functionability summary.formula, awesome!
from the help page i understand that method=reverse allows to
summarize all variables on the right hand side of formula 
(the help page on line 229 wrongly refers to the left? hand side variables)
in categories which are determined by a single left hand side
variable.

my problem is that the argument fun seems not to be compatible with
method=reverse!? every continuous variable is summarized in three
quantiles.

here is an example:

hist is a factor, PET and CT are "numeric" 

summary(PET~hist,data=her,fun=sum)
PET    N=47

+-------+------------------+--+---+
|       |                  |N |PET|
+-------+------------------+--+---+
|hist   |Morbus Hodgkin    |18| 81|
|       |Niedrigmaligne NHL|11| 39|
|       |Hochmaligne NHL   |18| 49|
+-------+------------------+--+---+
|Overall|                  |47|169|
+-------+------------------+--+---+
CT    N=47

+-------+------------------+--+---+
|       |                  |N |CT |
+-------+------------------+--+---+
|hist   |Morbus Hodgkin    |18| 70|
|       |Niedrigmaligne NHL|11| 16|
|       |Hochmaligne NHL   |18| 32|
+-------+------------------+--+---+
|Overall|                  |47|118|
+-------+------------------+--+---+

it would be desirable to combine both tables such that there is one
column for PET and one for CT ... is this possible?

trying method=reverse gives:

summary(hist~PET+CT,data=her,fun=sum,method="reverse") 

Descriptive Statistics by hist

+------+---------------+-------------------+----------------+
|      |Morbus Hodgkin |Niedrigmaligne NHL |Hochmaligne NHL |
|      |(N=18)         |(N=11)             |(N=18)          |
+------+---------------+-------------------+----------------+
|PET   |3.00/3.50/6.75 |1.50/3.00/6.00     |1.00/2.00/3.75  |
+------+---------------+-------------------+----------------+
|CT : 0|     0% (0)    |    36% (4)        |    28% (5)     |
+------+---------------+-------------------+----------------+
|    1 |    11% (2)    |     9% (1)        |    28% (5)     |
+------+---------------+-------------------+----------------+
|    2 |    28% (5)    |    36% (4)        |    11% (2)     |
+------+---------------+-------------------+----------------+
|    3 |    17% (3)    |     9% (1)        |    11% (2)     |
+------+---------------+-------------------+----------------+
|    4 |    11% (2)    |     9% (1)        |    17% (3)     |
+------+---------------+-------------------+----------------+
|    5 |     6% (1)    |     0% (0)        |     6% (1)     |
+------+---------------+-------------------+----------------+
|    6 |     6% (1)    |     0% (0)        |     0% (0)     |
+------+---------------+-------------------+----------------+
|    7 |    11% (2)    |     0% (0)        |     0% (0)     |
+------+---------------+-------------------+----------------+
|    8 |    11% (2)    |     0% (0)        |     0% (0)     |
+------+---------------+-------------------+----------------+

thanks a lot in advance,
tomy
#
On Fri, 11 Apr 2003 10:25:41 +0200
Thomas Gerds <gerds at fdm.uni-freiburg.de> wrote:

            
Sorry about the typo.  You are correct, that should have been "right hand side variables".
As stated in the documentation, fun applies only to method='response' and method='cross'.
Yes, see the documentation.  Create a bivariate response variable with cbind and use a bivariate summarization function as 'fun'.  And note that using 'stratify(someothervariable)' you can create multiple groups across columns as with method='reverse'; you just can't get statistical tests for them with method='response'.

Frank Harrell

  
    
#
On Fri, 11 Apr 2003, Thomas Gerds wrote:

            
It would be useful to say *where* you discovered it -- it is in a package
that isn't yet on CRAN.
Yes, that's what the help page says.

It also says that for the default method="response" the response variable
can be multivariate, which seems to be what you want.  It says many other
helpful things, too.


	-thomas
2 days later
#
thanks for both answers! sorry, for not reading the doc carefully
enough in the first place, and also for not referring to the marvelous
Hmisc package.

tomy

Thomas Lumley <tlumley at u.washington.edu> writes: