weighted_median_ratio: Weighted robust ratio based on median

Description Usage Arguments Value See Also Examples

View source: R/robsurvey.R

Description

A weighted median of the ratios y/x determines the slope of a regression through the origin.

Usage

1
weighted_median_ratio(x, y = NULL, w, na.rm = FALSE)

Arguments

x

a numeric vector (explanatory variable)

y

a numeric vector (response variable)

w

a numeric vector of (optional) weights

na.rm

a logical value indicating whether rows with NA values should be stripped before the computation proceeds

Value

a vector with two components: intercept and slope

See Also

line, weighted_line, weighted_median_line

Examples

1
2
3
x <- c(1,2,4,5)
y <- c(1,0,5,2)
weighted_median_ratio(y~x, w = rep(1, length(y)))

martinSter/robsurvey documentation built on Oct. 11, 2019, 4:45 p.m.