spgarbet / tangram

Table Grammar package for R
66 stars 3 forks source link

Hmisc transform msd not working for intercept models. #56

Closed spgarbet closed 4 years ago

spgarbet commented 4 years ago

Dan reports that the ‘msd’ logical does not work when “1 ~ v1 + v2 + v3….”. It does work when there is a variable on the left variable in the formula.

spgarbet commented 4 years ago
> library(tangram)
> tangram(drug ~ bili, pbc, msd=TRUE, id="1")
=========================================================================================================================
                          N          D-penicillamine                    placebo                    not randomized        
                                         (N=154)                        (N=158)                        (N=106)           
-------------------------------------------------------------------------------------------------------------------------
Serum Bilirubin (mg/dl)  418  0.70 *1.30* 3.60    3.65±5.28  0.80 *1.40* 3.22    2.87±3.63  0.70 *1.40* 3.12    3.12±4.04
=========================================================================================================================
N is the number of non-missing value. ^1 Kruskal-Wallis. ^2 Pearson. ^3 Wilcoxon.
> tangram(1 ~ bili, pbc, msd=TRUE, id="2")
===========================================================
                          N              Overall           
                                         (N=418)           
-----------------------------------------------------------
Serum Bilirubin (mg/dl)  418  0.80 *1.40* 3.40    3.22±4.41
===========================================================
N is the number of non-missing value. ^1 Kruskal-Wallis. ^2 Pearson. ^3 Wilcoxon.
spgarbet commented 4 years ago

Dan got back to me and it's specifically for the 'nejm' style which means it's in the nejm_iqr function.

> tangram(1 ~ bili, pbc, msd=TRUE, id="2", style="nejm")
======================================================
                                  N       Overall     
                                          (N=418)     
------------------------------------------------------
Serum Bilirubin (mg/dl)          418                  
   Median (interquartile range)       1.40 (0.80—3.40)
   Range                                 0.30—28.00   
======================================================
N is the number of non-missing value. ^1 Kruskal-Wallis. ^2 Pearson. ^3 Wilcoxon.
spgarbet commented 4 years ago
> tangram(1 ~ bili, pbc, msd=TRUE, id="2", style="nejm")
======================================================
                                  N       Overall     
                                          (N=418)     
------------------------------------------------------
Serum Bilirubin (mg/dl)          418                  
   Median (interquartile range)       1.40 (0.80—3.40)
   Range                                 0.30—28.00   
   Mean±SD                               3.22±4.41    
======================================================
N is the number of non-missing value. ^1 Kruskal-Wallis. ^2 Pearson. ^3 Wilcoxon.
> tangram(bili~ drug, pbc, msd=TRUE, id="2", style="nejm")
=====================================================
                    N      Serum Bilirubin (mg/dl)   
                                   (N=418)           
-----------------------------------------------------
drug                                                 
  D-penicillamine  154  1.30 (0.70—3.60)    3.65±5.28
  placebo          158  1.40 (0.80—3.22)    2.87±3.63
  not randomized   106  1.40 (0.70—3.12)    3.12±4.04
=====================================================
N is the number of non-missing value. ^1 Kruskal-Wallis. ^2 Pearson. ^3 Wilcoxon.