Quantile Regression Reporting Made Easy: How to Create Stunning Plots and Tables in Minutes!
HTML-код
- Опубликовано: 23 ноя 2024
- In the previous episode, I presented four reasons why Quantile Regression (QR) is a better alternative to classic linear regression. However, I discovered that reporting QR results can be quite demanding. To make the process easier, I created better plots for model estimates and predictions, a comprehensive table of model results, including contrasts between groups and p-values. I found this code so useful that I thought you guys might benefit from it too. Besides, I really enjoyed programming it
If you only want the code (or want to support me), consider join the channel (join button below any of the videos), because I provide the code upon members requests.
Enjoy! 🥳
Welcome to my VLOG! My name is Yury Zablotski & I love to use R for Data Science = "yuzaR Data Science" ;)
This channel is dedicated to data analytics, data science, statistics, machine learning and computational science! Join me as I dive into the world of data analysis, programming & coding. Whether you're interested in business analytics, data mining, data visualization, or pursuing an online degree in data analytics, I've got you covered. If you are curious about Google Data Studio, data centers & certified data analyst & data scientist programs, you'll find the necessary knowledge right here. You'll greatly increase your odds to get online master's in data science & data analytics degrees. Boost your knowledge & skills in data science and analytics with my engaging content. Subscribe to stay up-to-date with the latest & most useful data science programming tools. Let's embark on this data-driven journey together!
Thank you! your videos are very helpful and easy to follow. I really appreciate your effort.
I’m glad you enjoyed them! Thanks for watching
Thanks for sharing, Prof.
Always welcome!
I'm doing better analysis of my PhD data because of your videos, thanks a lot!
I am glad my content is helpful! Thanks for watching and commenting! That’s the best support 🙏
Very good job, thanks a lot.
Glad you liked it! Thanks for watching!
useful as always! thanks!
Glad to hear that! Thank you for watching!
This one is completely out of the world. I need to watch this a couple more times to absorb the sea of knowledge from this video. HOWEVER, I have a couple of questions:
I was thinking why not write a small package to help people do this, but eventually you provided the code. Do you still think it's worth making a package on?
2. I heard at the beginning you saying means and predictions, are these really different? When using the emmeans package, are we not just getting the average of the dependent variable for individual groups based on the model? On a related note doesn't the emmeans function and ggpredict function produce the same results?
I'll stop here for now...
Thanks again for the wonderful work you do and the unique video presentation style you use.
thanks a lot, mate! There are some reason I don't plan to create a package: I don't have much programming knowledge about how to create a package, only few unrelated functions here and there are a mess and will not fit together, and I don't have much time, due to a normal job. And I work a lot. However, there is a possibility to write a feature request on the github pare of quantreg package. I might do it myself, but I think it sounds a bit needy when I request them to use my function ;) you could ask them if you wish ;)
oh, no, ggemmeans and emmens produce the same result. ggpredict, or ggeffect produce slightly different estimates.
Thank you so much for sharing this amazing way of making figures! One question is, how to switch the y and x-axis if I want to show tau on the x-axis?
Thanks 🙏 for the feedback! Sure, just delete the coord_flip() line
Thanks for the demonstration. Can you please make a detailed video of Multivariate Probit model???
Noted. It might take me some time since the list is long and I have a day job. But I planned it already anyway. Thanks for watching!
@@yuzaR-Data-Science Thank you very much..
@@Endrumpf You are very welcome!
Another great tutorial. Thank you so much, my dear professor.
I have just one question. I'm using the ANCOVA model for my pre-post-test analysis, where the outcome is the post-test, the independent variable is my group, and the covariate is the pre-test value. I use the emmeans package to get adjusted means.
My question is, how can I get an adjusted median in quantile regression for non-parametric data?
The QR doesn't care whether the data is non-parametric. So, just use QR and emmeans as described in the video. Here is the code for you:
library(emmeans)
emmeans(qr_all,
pairwise ~ education,
by = "tau",
tau = c(.1, .9),
weights = "prop") # infer = T
That will give you the adjusted medians + 95% CIs.
@@yuzaR-Data-Science
Sir, I don't know how to thank you. I'm very grateful for your fast reply.
I owe you a lot. Greetings from Egypt.
you are very welcome! the best support you can do is actually free - just continue watching, liking, commenting and sharing my videos. and, by the way, you'll learn some useful things ;) thanks!
Hi professor.Is there any way we can dynamically adjust line in quantile regression plot and it should affect other plots
Which line do you mean? And which other plots?
Hi Professor, is there a method to determine the best predictors per quantile, or the best model per quantile
thank you
that's an amazing question! actually the t-values in a boring summary function could be considered the measure of importance. here is a code example, where you can display all the t-values for all quantiles:
qr_all
Thank you so much for this insightful video! Can I have the code please
unfortunately, my blog was shut down. but even if it werent, I don't recommend to copy paste. just make each step work and then you'll be able to connect them. you'll learn so much more. thanks for watching
@@yuzaR-Data-Science plot_models(lr, qr10, qr50, qr90, show. values = TRUE,
+
m. labels = c("LR","QR 10%", "QR 50%", "QR 90%"),
legend. title = "Model type")
it doesn't work for me, I've tried many times Error: unexpected symbol in "plot_models(lr, q10, r50, 9r90" Could not recover model data from environment. Please make sure your data is available in
your workspace.
Hi, could it be just a typing mistake? Because I see " 9r90" istead of "qr90". If it is, don't beat yourself up to strong :) 90% of coding mistakes are typos ;) Let me know if it is still not working and I'll do my best to help!
Thanks for your replay, the last part is not running, can you please explain what should I put in the ncol = ??, nrow = ??. thanks again
:) 2 for two rows in nrows and 3 (or how many you want) for three columns in ncol ;) ... oh by the way, nice name, I am also based in Germany .... Munich. cheers mate
I have tried to replicate your video, however, I am facing a problem when I run the following code:
q_plot
It still works at my PC. I guess the data frame which contains UCL is somehow not ready for the function. Or some packages, like broom or rstatix are not installed yet. Check this and get back to me whether it worked. Cheers
Got it, thanks! I managed to fix the code, and it's working now. Appreciate your quick response. Keep those helpful videos coming!@@yuzaR-Data-Science
glad it works now! please, produce some kick ass science with that ;) I'll do my best to produce more useful content. Thanks for support!
Does that work for panel data?? Thanks!!
I never tried. I know that quantile regression works with panel data, but I am not sure about emmeans. Have a look at rqpd package
hello everyone, please for those who managed to run the code, I'm struggling with the plat layout as I have only numeric variables; this is the error I got
Error in plot_layout(ncol = 3, nrow = 2) + plot_annotation(title = "XXX", :
non-numeric argument to binary operator
Any help is much appreciated. Thank you so much
>
hallo again, just answered you previous comment. this error message does not point our a specific problem. could you run the code line by line and then identify where the problem exactly is? the plot_layout needs number of columns and number of rows for creating subplots of already pre-produced plots, so you need to expect 6 subplots, but if you don't have them (hard to know what you exactly do without data), it won't work. so, first question can you run that:
job + age + edu_hs + edu_sc + edu_coll + edu_high +
plot_layout(ncol = 3, nrow = 2)
or that:
job + age + edu_hs + edu_sc + edu_coll + edu_high
???
@@yuzaR-Data-Science Thank you for your replay, I have a 10 independent variables, all of them are numeric, so there is no subcategory. I don't know what to put in the intercept and estimate... ie I have a var named lnepu , I don't understand what to put in intercept and estimate when I call the function cool QR: lnepu
oh, don't worry about those two when the rest is running. they are only for the labels, last part of the function, and are just a peace of text you want on the x-axis of the plot. numeric predictors are fine, like the predictor "age" in the video. So, similarly to "age":
cool_QR_plot("age", "age = 0", "increasing age")
this should work:
cool_QR_plot("lnepu", "lnepu = 0", "increasing lnepu")
Hello. Do you want to make a video about tidyclust?
What does tidyclust do?