powered by
A weighted median of the ratios y/x determines the slope of a regression through the origin.
weighted_median_ratio(x, y = NULL, w, na.rm = FALSE)
a numeric vector (explanatory variable)
a numeric vector (response variable)
a numeric vector of (optional) weights
a logical value indicating whether rows with NA values should be stripped before the computation proceeds
NA
a vector with two components: intercept and slope
line, weighted_line, weighted_median_line
line
weighted_line
weighted_median_line
# 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