View source: R/calchubermeandif.R
calchubermeandif | R Documentation |
Computes the difference between Huber's M-estimator of location of two groups in long data format.
calchubermeandif(x, indices, ...)
x |
A data frame or matrix containing the input data. The first column should be the variable of interest, and the second column should be the grouping variable. |
indices |
Optional; specific rows to be considered. If not provided, all rows are used. |
... |
Additional arguments passed to the internal hubermean function. |
This function demonstrates the structure of a user-defined statistic function to use with bootstrap and permutation test. The function calculates the difference between Huber's M-estimator of location of two groups using the iterative weighted mean method. Huber's M-estimator of location is robust to outliers and is computed using an iterative re-weighting procedure. The internal function follows:
Initialize with the median of the data.
Compute weights based on deviations from the current mean.
Update the mean iteratively until convergence is reached.
A numeric value representing the difference between Huber's M-estimator of location of the two groups.
Zeynel Cebeci, A. Firat Ozdemir, Engin Yildiztepe
median
df <- data.frame(value = rnorm(100), group = rep(1:2, each = 50))
bivarplot(df)
# Bootstrap confidence intervals for the difference of
# Huber's M-estimator of location of two groups
# Increase R for real-world applications
bshubermean <- bootstrap(df, statistic=calchubermeandif, alpha=0.05,
alternative="less", R=200)
bshubermean
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.