What is a quantile in ggplot stat_quantile?

Here are my reproducible data:

library("ggplot2") library("ggplot2movies") library("quantreg") set.seed(2154) msamp <- movies[sample(nrow(movies), 1000), ] 

I am trying to get acquainted with stat_quantile , but in the example from the documentation a few questions arise.

 mggp <- ggplot(data=msamp, mapping=aes(x=year, y=rating)) + geom_point() + stat_quantile(formula=y~x, quantiles=c(0, 0.25, 0.50, 0.75, 1)) + theme_classic(base_size = 12) + ylim(c(0,10)) mggp 
  • As far as I understand, the quantile broke the data into parts that are less than the specified cutoff values, right? If I define quantiles, as in the following code, I get five lines. What for? What do they represent?

  • Quantiles seem to be calculated based on a dependent variable along the y axis (rating). Can this be undone? I want to break quantile data into "year"?

+5
source share
1 answer

This function performs a quantile regression, and each row is an indicator.

From Wikipedia :

Quantitative regression is a type of regression analysis used in statistics and econometrics. While the least squares method leads to estimates that approximate the conditional average of the response variable for certain values โ€‹โ€‹of the predictor variables, quantile regression is aimed at evaluating either the conditionally median or another quantile of the response variable.

Thus, each row in the regression graph represents an estimate of the quantile value, for example. middle, 75th and 100th percentiles.

A detailed technical discussion can be found in vignette quantreg .

enter image description here

+2
source

Source: https://habr.com/ru/post/1239371/


All Articles