For my own use, I wrote an R function to plot the observed probability (with error bars) of some binary outcome by quantiles of some continuous predictor variable. Among other things, I plan to use it to check the linearity assumption for logistic regression.

Would there be an appropriate way to share this function with others on CV? I think others might find it useful since I don't believe there's an off-the-rack implementation, and I certainly would be very grateful if others pointed out any bugs.


2 Answers 2


If it answers a particular question it is ok (you can even make your own question and answer it yourself if you would like). Just note here isn't the place for code review: any question needs to have some relation to stats outside of programming, as explained in the FAQ.

ps - You may want to check the references on this answer. Their visual diagnostics are very similar in nature to what you are proposing.

  • 1
    $\begingroup$ +1 Also: on the topic of answering one's own question with an answer, while I have not (yet) shared the code, I did share my own answer of a new (?) kind of graph: stats.stackexchange.com/a/340460/44269 $\endgroup$
    – Alexis
    Apr 26, 2019 at 16:56

Sure, you can find many answers including code examples (more or less sophisticated) on our site. Remember however that code should serve as an example, so you should not post code-only answer without any explanation. Also I'd recommend to post the kind of code that is easy to understand rather then complicated, "production-quality" code. So better post few lines of code that solve particular problem, rather then multiline general solution. If your code is long and complicated, then better post a link to https://gist.github.com/ or similar place.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .