Create a Weibull Probability Paper Plot in R

Multi tool use
Create a Weibull Probability Paper Plot in R
I am trying to create a base plot for a weibull probability plot. I have been exploring the survival
package in R but have not found the exact tool I need yet. So far I have been able to recreate the plot I need by hand (which is terrible - tons of hard coding, it is not flexible at all and looks terrible).
survival
My guess is that there is a package to create this base graph, with the grid lines, I just haven't discovered it yet.
This image is what I need to graph, it is called "Weibull probability plotting paper"
Is there a way in ggplot2
or within the survival
package (or anything other that base R graphics) to create this plot? From there, I can overlay the points.
ggplot2
survival
Please keep in mind the graphics I create in the end will need to be compatible with Shiny
. Thank you.
Shiny
For reference this is the ugly plot I have managed to create using ggplot2
by hand.
ggplot2
Also, please note I cannot provide a reproducible code example since this is a very complex problem, I am looking for a basic reproducible base plot.
UPDATE
I am looking for a what to produce this plot, here is some examples of how I created mine by hand, please note it is not fully reproducible.
Here is how I set up the y-axis tick marks:
yticks <- c(log(-log(1-0.0001)), log(-log(1-0.001)), log(-log(1-0.005)), log(-log(1-0.010)), log(-log(1-0.05)), log(-log(1-0.10)),
log(-log(1-0.50)), log(-log(1-0.90)), log(-log(1-0.99)))
Here are the y-labels:
ylabs <- c('0.01','0.1','0.5','1','5','10','50','90','99')
Here is how to create the minor grid lines:
yminorticks <- c(
log(-log(1-0.00001)),log(-log(1-0.00002)),log(-log(1-0.00003)),log(-log(1-0.00004)),log(-log(1-0.00005)),log(-log(1-0.00006)),log(-log(1-0.00007)),log(-log(1-0.00008)),log(-log(1-0.00009)),
log(-log(1-0.0001 )),log(-log(1-0.0002)),log(-log(1-0.0003)),log(-log(1-0.0004)),log(-log(1-0.0005)),log(-log(1-0.0006)),log(-log(1-0.0007)),log(-log(1-0.0008)),log(-log(1-0.0009)),
log(-log(1-0.001)),log(-log(1-0.002)),log(-log(1-0.003)),log(-log(1-0.004)),log(-log(1-0.005)),log(-log(1-0.006)),log(-log(1-0.007)),log(-log(1-0.008)),log(-log(1-0.009)),
log(-log(1-0.01)),log(-log(1-0.02)),log(-log(1-0.03)),log(-log(1-0.04)),log(-log(1-0.05)),log(-log(1-0.06)),log(-log(1-0.07)),log(-log(1-0.08)),log(-log(1-0.09)),
log(-log(1-0.10)),log(-log(1-0.20)),log(-log(1-0.30)),log(-log(1-0.40)),log(-log(1-0.50)),log(-log(1-0.60)),log(-log(1-0.70)),log(-log(1-0.80)),log(-log(1-0.90)))
I cannot provide a reproducible example since I do not have a way of creating this plot. That is my question, how to create this base plot in a simple and reproducible manner. Thanks.
– user9842212
Jul 2 at 15:40
Just an aside on your minor grid line code:
log
, and subtraction are all vectorized. vectorization means you can do, e.g., log(-log(1 - seq(0.01, 0.09, by = 0.01)))
instead of c(log(-log(1-0.01)),log(-log(1-0.02)),log(-log(1-0.03)),log(-log(1-0.04)), ... )
– Gregor
Jul 2 at 16:05
log
log(-log(1 - seq(0.01, 0.09, by = 0.01)))
c(log(-log(1-0.01)),log(-log(1-0.02)),log(-log(1-0.03)),log(-log(1-0.04)), ... )
You can generate
yminorticks
with yminorticks <- c(log(-log(1-outer(1:9, 10^(-5:-1)))))
rather than writing all that out. Though you probably want to be using log10
rather than log
– MrFlick
Jul 2 at 16:06
yminorticks
yminorticks <- c(log(-log(1-outer(1:9, 10^(-5:-1)))))
log10
log
I think what you want to do for ggplot2 is define your own transformation with the scales package and use that with the
trans=
argument for scale_x_continuous
. Here's an example where I do something similar to make a sign-restoring cox-box transformation github.com/ellisp/frs-r-package/blob/master/pkg/R/…– Peter Ellis
Jul 3 at 2:55
trans=
scale_x_continuous
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
You just want a plot with log scales? When asking for help, you should include a simple reproducible example with sample input and desired output that can be used to test and verify possible solutions.
– MrFlick
Jul 2 at 15:38