Description Usage Arguments Details Value Note Author(s) References See Also Examples
The main function of the CBCgrps package.
1 2 3 4 5 6 |
df |
The data frame on which statistical descroption and inference are performed. |
gvar |
The group variable. |
p.rd |
Decimal space of p value to be displayed. If the p value is less than the minimum value of that decimal space, it will print less than that value. For instance, if p.rd = 3 and p = 0.00045, then it will print "<0.001" in the p column of the table. |
varlist |
Specify a vector of variable names to be compared between groups (i.e. not all variables in the *df* will be compared and users can choose which variables to be compared). This argument also allows to specify the order in which the variables will appear in the table. It will issue an error message if varlist contains variable names not found in the df. |
skewvar |
Specify a vector of variable names which are considered to be not normally distributed. This function is useful for some large datasets where the normality test is too sensitive and users may want to specify skew variables by their own judgement. skewvar is NULL by default. If it is not NULL and skew data were specified by the users, the statistical test for normality is switched off. |
norm.rd |
Decimal space of normally distributed numeric variables to be displayed. |
sk.rd |
Decimal space of skewed numeric variables to be displayed. |
tabNA |
Weather categorical variables with NA be displayed or not. "no" to be omitted, "ifany" to be displayed. The default value is "no". |
cat.rd |
Decimal space of categorical variables (the proportion) to be displayed. |
pnormtest |
Significance level for the normal test. It is 0.05 by convention (default). However, for some large datasets the test will be too sensitive that only a small deviation in magnitude from the normal distribution will give a p value less than 0.05. In this situation, users can specify smaller significance level. Note that the normality test will no longer be used to judge the normality if the skewvar argument is not NULL. |
maxfactorlevels |
The maximum levels for factor variables, the default is 30. The argument is used to avoid treating date or time variables as factor variables. |
minfactorlevels |
If a numeric variable has only several values, it is treated as categorical variable. The default value is 10. |
sim |
a logical indicating whether to compute p-values by Monte Carlo simulation, in larger than 2 by 2 tables. The default is FALSE. |
workspace |
If the fisher.test() fucntion requires more workspace, it can be defined here. The default is workspace euqals to 2e+05. |
ShowStatistic |
logic value for whether showing statistics or not. The defaule is FALSE for not showing statistics. Statistics is used for statistical inference such as F value for Chi-square test and T value for student t test. No statistic will be shown because Fisher's exact test jumps past a test statistic and goes straight to a p-value. |
The function compares differences in categorical and continuous variables between three or more groups. The function automatically judges the distribution of the continuous variable and use appropriate description for them. Chi-square test is used for categorical data. Analysis of variance is used for normally distributed numeric data. Kruskal-Wallis rank sum test is used for non-normally distributed data. It is common that some categorical variables contain numeric or integer values. For example, the gender variable may contain values 1 and 2, representing male and female respectively. Such a variable can be identified by counting the number of integer values. Thus, the minfactorlevels argument is used to define the minimum value for a variable to be considered as numeric variable. For some large dataset, the normality test is extremely sensitive that a small deviation from normal distribution will lead to the rejection of the null hypothesis of normality. In such a circumstance, users may opt to switch off the normality test by explicitly specify the skewed data (i.e. skewvar=some variables names) or set a smaller p value for normal test (i.e. pnormtest=0.0001).
Table |
The table with string values. The mean and standard error are put in a single cell, and connected by plus and minus symbol. |
No further notes
Zhongheng Zhang Department of emergency medicine, Sir Run-Run Shaw Hospital, Zhejiang University School of Medicine, Hangzhou, 310016, China. zh_zhang1984@zju.edu.cn
Myles Hollander and Douglas A. Wolfe (1973), Nonparametric Statistical Methods. New York: John Wiley&Sons. Pages 115-120.
Zhang Z. Univariate description and bivariate statistical inference: the first step delving into data.Ann Transl Med. 2016 Mar;4(5):91.
Zhang Z, Gayle AA, Wang J, Zhang H, Cardinal-Fernasndez P. Comparing baseline characteristics between groups: an introduction to the CBCgrps package. Ann Transl Med. 2017 Dec;5(24):484. doi: 10.21037/atm.2017.09.39.
No other reference
1 2 3 |
Loading required package: nortest
$table
[,1] [,2] [,3]
tm.names "tot" "grp1" "grp2"
crp "89.61<U+00B1>19.68" "87.67<U+00B1>19.49" "90.84<U+00B1>19.15"
hb "10.03<U+00B1>3.99" "9.97<U+00B1>4.4" "10.1<U+00B1>3.67"
ddimer "0.13(0.06,0.24)" "0.1(0.03,0.2)" "0.14(0.07,0.24)"
wbc "6.5(5.88,7.31)" "6.48(5.77,7.5)" "6.48(5.92,7.38)"
sex_female "388(39)" "18(29)" "87(41)"
sex_male "612(61)" "45(71)" "123(59)"
mort_alive "798(80)" "47(75)" "172(82)"
mort_dead "202(20)" "16(25)" "38(18)"
[,4] [,5] [,6]
tm.names "grp3" "grp4" "grp5"
crp "89.77<U+00B1>19.66" "88.03<U+00B1>20.48" "89.98<U+00B1>20.02"
hb "9.93<U+00B1>3.81" "9.58<U+00B1>4.13" "9.98<U+00B1>4.05"
ddimer "0.12(0.05,0.21)" "0.14(0.05,0.29)" "0.13(0.06,0.25)"
wbc "6.43(5.94,7.21)" "6.4(5.88,7.26)" "6.5(5.82,7.19)"
sex_female "59(39)" "25(34)" "127(40)"
sex_male "91(61)" "49(66)" "187(60)"
mort_alive "117(78)" "63(85)" "258(82)"
mort_dead "33(22)" "11(15)" "56(18)"
[,7] [,8] [,9]
tm.names "grp6" "grp7" "p"
crp "87.99<U+00B1>20.26" "90.33<U+00B1>19.48" "0.86"
hb "10.15<U+00B1>4.32" "10.46<U+00B1>4.32" "0.92"
ddimer "0.16(0.11,0.23)" "0.11(0.05,0.26)" "0.115"
wbc "6.78(5.95,7.48)" "6.65(6.03,7.08)" "0.912"
sex_female "23(32)" "27(40)" "0.421"
sex_male "49(68)" "40(60)" "0.421"
mort_alive "53(74)" "50(75)" "0.304"
mort_dead "19(26)" "17(25)" "0.304"
$table.cat
No.tot per.tot No.1 per.1 No.2 per.2 No.3 per.3 No.4 per.4 No.5
sex_female 388 39 18 29 87 41 59 39 25 34 127
sex_male 612 61 45 71 123 59 91 61 49 66 187
mort_alive 798 80 47 75 172 82 117 78 63 85 258
mort_dead 202 20 16 25 38 18 33 22 11 15 56
per.5 No.6 per.6 No.7 per.7 p
sex_female 40 23 32 27 40 0.421
sex_male 60 49 68 40 60 0.421
mort_alive 82 53 74 50 75 0.304
mort_dead 18 19 26 17 25 0.304
$table.norm
mean sd mean.1 sd.1 mean.2 sd.2 mean.3 sd.3 mean.4 sd.4 mean.5
crp 89.61 19.68 87.67 19.49 90.84 19.15 89.77 19.66 88.03 20.48 89.98
hb 10.03 3.99 9.97 4.40 10.10 3.67 9.93 3.81 9.58 4.13 9.98
sd.5 mean.6 sd.6 mean.7 sd.7 p
crp 20.02 87.99 20.26 90.33 19.48 0.86
hb 4.05 10.15 4.32 10.46 4.32 0.92
$table.skew
median IQR1 IQR3 median.1 IQR1.1 IQR3.1 median.2 IQR1.2 IQR3.2 median.3
ddimer 0.13 0.06 0.24 0.10 0.03 0.2 0.14 0.07 0.24 0.12
wbc 6.50 5.88 7.31 6.48 5.77 7.5 6.48 5.92 7.38 6.43
IQR1.3 IQR3.3 median.4 IQR1.4 IQR3.4 median.5 IQR1.5 IQR3.5 median.6
ddimer 0.05 0.21 0.14 0.05 0.29 0.13 0.06 0.25 0.16
wbc 5.94 7.21 6.40 5.88 7.26 6.50 5.82 7.19 6.78
IQR1.6 IQR3.6 median.7 IQR1.7 IQR3.7 p
ddimer 0.11 0.23 0.11 0.05 0.26 0.115
wbc 5.95 7.48 6.65 6.03 7.08 0.912
$g1
[1] "cirrhosis"
$g2
[1] "COPD"
$g3
[1] "diabetes"
$g4
[1] "heartfailure"
$g5
[1] "hypertension"
$g6
[1] "renalfailure"
$g7
[1] "stroke"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.