yuryzablotski / yuzaR-Blog

11 stars 3 forks source link

your Quantile Regression Blogpost and Video = Excellent! + a Question #1

Closed sfd99 closed 1 year ago

sfd99 commented 1 year ago

Hi Yury!

Your Quantile Regression post: https://yuzar-blog.netlify.app/posts/2022-12-01-quantileregression/

is truly Excellent ! (and the video, too).

Question:

In section: 4. Model more than just mean or just median - model several quantiles

just after this R code:

library(ISLR)
lr   <- [lm](https://rdrr.io/r/stats/lm.html)(wage ~ jobclass, data = Wage)
qm10 <- [rq](https://rdrr.io/pkg/quantreg/man/rq.html)(wage ~ jobclass, data = Wage, tau = 0.10)
qm50 <- [rq](https://rdrr.io/pkg/quantreg/man/rq.html)(wage ~ jobclass, data = Wage, tau = 0.50)
qm90 <- [rq](https://rdrr.io/pkg/quantreg/man/rq.html)(wage ~ jobclass, data = Wage, tau = 0.90)

[plot_models](https://strengejacke.github.io/sjPlot/reference/plot_models.html)(lr, qm10, qm50, qm90,
            show.values = TRUE,
            m.labels = [c](https://rdrr.io/r/base/c.html)("LR", "QR 10%", "QR 50%", "QR 90%"), 
            legend.title = "Model type")+
  [ylab](https://ggplot2.tidyverse.org/reference/labs.html)("Increase in wage after switch to IT")

the plot image:

image

shows only: 2. Information on the Y-axis.

If the factor/categorical var:
jobclass has 2 possible category values: (1. Industrial AND 2. Information)

why is only:
2. Information
shown as a label on the Y-axis?. Why not BOTH values: (1. Industrial AND 2. Information)...?.

Yury, any super-clear, baby-steps explanation of what's happening here, is highly appreciated.

Hey!. This plot is the only part I didn't understand, so far... :-)

Thanks / Danke Yury! sfd99 Rstudio / Ubuntu Linux San Francisco ============

yuryzablotski commented 1 year ago

Hey sfd99,

Sure, its because only the estimates (slopes) are shown, and they simply tell us the change from the intercept, which is the first level - industrial.

So, a command, like summary(lr) or tab_model(lr) would also give you one - the second level of the predictor jobclass. But if you use plot_model(lr, type = “pred”) you’ll be able to display both levels, but, unfortunately not several different models + stars on the same plot.

Hope that helps. I rarely check the email, so, if you don’t might, the best way to get a question is on the YouTube channel in the comments section after the video, I’ll address them all and quicker.

Cheers and thanks for the nice feedback!

Yury

On 5. Jan 2023, at 22:33, sfd99 @.***> wrote:

sfd99

sfd99 commented 1 year ago

Ah - yes, understand better now.

Hope you can +add your explanation to the text in the Blog post itself - it will help others, too!. :-)

Thanks / Danke Yury. sfd99 Rstudio / Ubuntu Linux San Francisco ============

yuryzablotski commented 1 year ago

Just did ;) Cheers

On 8. Jan 2023, at 17:08, sfd99 @.***> wrote:

Ah - yes, understand better now.

Hope you can +add your explanation to the text in the Blog post itself - it will help others, too!. :-)

Thanks / Danke Yury. sfd99 Rstudio / Ubuntu Linux San Francisco

— Reply to this email directly, view it on GitHub https://github.com/yuryzablotski/yuzaR-Blog/issues/1#issuecomment-1374871009, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASH44QSIUHW5KGEGM4KGGE3WRLRBLANCNFSM6AAAAAATSM47DY. You are receiving this because you commented.

sfd99 commented 1 year ago

Thanks Yury.

You really have a "knack" for explaining concepts clearly... +Appreciated!.

(closing Issue#1).