View source: R/groupwiseMedian.r
groupwiseMedian | R Documentation |
Calculates medians and confidence intervals for groups.
groupwiseMedian(
formula = NULL,
data = NULL,
var = NULL,
group = NULL,
conf = 0.95,
R = 5000,
boot = FALSE,
pseudo = FALSE,
basic = FALSE,
normal = FALSE,
percentile = FALSE,
bca = TRUE,
wilcox = FALSE,
exact = FALSE,
digits = 3,
...
)
formula |
A formula indicating the measurement variable and the grouping variables. e.g. y ~ x1 + x2. |
data |
The data frame to use. |
var |
The measurement variable to use. The name is in double quotes. |
group |
The grouping variable to use. The name is in double quotes. Multiple names are listed as a vector. (See example.) |
conf |
The confidence interval to use. |
R |
The number of bootstrap replicates to use for bootstrapped statistics. |
boot |
If |
pseudo |
If |
basic |
If |
normal |
If |
percentile |
If |
bca |
If |
wilcox |
If |
exact |
If |
digits |
The number of significant figures to use in output. |
... |
Other arguments passed to the |
The input should include either formula
and data
;
or data
, var
, and group
. (See examples).
With some options, the function may not handle missing values well.
This seems to happen particularly with bca = TRUE
.
A data frame of requested statistics by group.
The parsing of the formula is simplistic. The first variable on the left side is used as the measurement variable. The variables on the right side are used for the grouping variables.
Results for ungrouped (one-sample) data can be obtained by either
setting the right side of the formula to 1, e.g. y ~ 1, or by
setting group=NULL
.
Salvatore Mangiafico, mangiafico@njaes.rutgers.edu
https://rcompanion.org/handbook/E_04.html
groupwiseMean
,
groupwiseHuber
,
groupwiseGeometric
### Example with formula notation
data(Catbus)
groupwiseMedian(Steps ~ Teacher + Gender,
data = Catbus,
bca = FALSE,
percentile = TRUE,
R = 1000)
### Example with variable notation
data(Catbus)
groupwiseMedian(data = Catbus,
var = "Steps",
group = c("Teacher", "Gender"),
bca = FALSE,
percentile = TRUE,
R = 1000)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.