Learn R Programming

robsurvey (version 0.1.0)

weighted_median_ratio: Weighted robust ratio based on median

Description

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

Usage

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

Run this code
# NOT RUN {
x <- c(1,2,4,5)
y <- c(1,0,5,2)
weighted_median_ratio(y~x, w = rep(1, length(y)))
# }

Run the code above in your browser using DataLab