ci.test argument for plotreg
mfransham opened this issue · 8 comments
First, thanks so much for the recent updates to texreg, especially the knitreg function - not having to switch functions to get the correct output is a massive bonus, and it really helps with teaching students. They can see a table in the console and get the same table in LaTeX without having to switch around - really good for beginners (I will also submit this via praise().
One useful addition would be a ci.test argument for plotreg(), similar to that for knitreg(). I've used (and taught my students to use) plotreg for regression coefficients, but in the case where we are plotting odds ratios, plotreg() gives us a line at 0 rather than 1 where we would really want it. It would be useful to have the flexibility to alter this.
Thanks again for all your work.
plotreg
uses by default confidence intervals. If you need to change the confidence interval, you can use ci.level
. If you want to plot standard errors; instead, you can use use.se = TRUE
. You can also replace coefficients the usual way if you want to plot odd ratios. The significance of an odds ratio is the same as the coefficient from which it is derived, so you should not have problems customizing if you want to plot something different than the standard.
I'm not sure this fully answer your question, but it might be helpful.
C.
Thanks for taking the time to reply Claudia and for your advice above. As default plotreg()
plots a dotted line at 0 with
geom_hline(yintercept = 0)
It would be useful to change this to
geom_hline(yintercept = ci.test)
with ci.test = 0
as a default, but then the ability to set ci.test = 1
if the user is plotting odds ratios.
Happy to suggest some code in the new year when I get back to my desk.
Best wishes
Mark
I understand what you mean now. Thanks for clarifying. It's very simple to add this if Philip agrees with this change. I could also do it.
I understand what you mean now. Thanks for clarifying. It's very simple to add this if Philip agrees with this change. I could also do it.
Sure, please go ahead! Thanks!
Great, thank you! Also it would be useful to include the ci.test argument in the parts of the function that determine the colour of the bars i.e. so that they are coloured as statistically significant when the confidence intervals do not include the value of ci.test
Thanks again, and have a good Christmas break!
Nope. Sorry, I have been very busy with teaching. The first thing asked takes 30 seconds. For the second I need to open up the code and check what's the best way to do it. I'll get to it ASAP.
@mfransham sorry, it took me a while to finish this, but now it's done. Please let me know if this is fine for what you need or if you meant something slightly different/have further suggestions.
You can wait until Philip process the pull request or test it from my fork:
remotes::install_github("czucca/texreg", ref = "plotregUpG", dependencies = TRUE, force = TRUE)
Best,
C.