Computes descriptive statistics for the relationship between a categorical
variable y and a numeric variable x.
Usage
.descQN(y, x, conf.level = 0.95, breaks, right)
# S3 method for class 'Desc.qn'
print(x, verbose = NULL, ...)Arguments
- x
a numeric variable
- verbose
amount of printed output
- ...
further arguments passed to methods
- y
a categorical variable (factor or coercible to factor)
- conf.level
confidence level for interval estimates (default 0.95)
- breaks
numeric vector defining cut points for
x. If not supplied, quartiles ofxare used.- right
logical; passed to
cut(), defining interval closure
Value
an object of class c("Desc.qn", "Desc") with components:
grpTablegroup-wise summary table
kwresult of the Kruskal-Wallis test
eta2effect size
leveneresult of Levene's test
tauBestimate, confidence interval, and p-value for Kendall's tau-b
spearmanestimate, confidence interval, and p-value for Spearman's correlation
aucarea under the curve for a binary outcome
prevTableprevalence table for a binary outcome with columns:
quantilequantile group
nnumber of complete cases in the group
estpoint estimate of the prevalence
lcilower confidence interval bound
uciupper confidence interval bound
caTestresult of the Cochran-Armitage test for a binary outcome
Details
The function summarizes how a numeric variable x differs across
levels of a categorical variable y.
Computed statistics
Group-wise descriptive statistics (median, IQR, counts)
Kruskal-Wallis test with effect size (\(\eta^2\))
Levene's test for homogeneity of variance
Kendall's Tau-b with confidence interval and p-value
Spearman correlation (reported for higher verbosity levels)
Binary outcomes
If y has two levels:
Area under the curve (AUC)
Prevalence across quantile groups of
xCochran-Armitage trend test
Quantile grouping
The numeric variable x is optionally discretized using
breaks. By default, quartiles are used.
See also
desc(), desc.nn(), desc.nq(),
kruskal.test(), lumen::leveneTest()
Other desc:
desc(),
desc.Date(),
desc.factor(),
desc.nn,
desc.nq,
desc.numeric(),
desc.qq,
desc.table(),
desc.ts()
