Description Usage Arguments Details References See Also Examples

Function to compute the weighted median.

1 | ```
weighted.median(x, w = 1, na.rm = FALSE)
``` |

`x` |
a numeric vector containing the values whose median is to be computed. |

`w` |
weights that are used to compute the median. This can be either a
single value (which will be used as weight for all observations)
or a numeric vector of the same length as |

`na.rm` |
logical. Should |

The weighted median is computed as the value where the cumulative relative weights (relative to the sum of all weights) crosses 0.5.

This function is used in the stabilization of the negative gradient via the meadian absolute deviation (MAD). For details see Hofner et al (2015).

B. Hofner, A. Mayr, M. Schmid (2016). gamboostLSS: An R Package for Model Building and Variable Selection in the GAMLSS Framework. Journal of Statistical Software, 74(1), 1-31.

Available as `vignette("gamboostLSS_Tutorial")`

.

`glmboostLSS`

, `gamboostLSS`

and
`blackboostLSS`

for fitting of GAMLSS where the
standardization is explained in more detail.

1 2 3 4 5 6 7 8 9 | ```
## compute the weighted median with case weights
x <- c(1, 2, 3, 4)
w <- c(0, 1, 2, 3)
weighted.median(x, w)
## compute the weighted median with arbitrary weights
x <- rnorm(100)
w <- runif(100)
weighted.median(x, w)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.