Pregunta

I am new to R and I am having problems using the Weibull distribution function.

I have to use cumulative distribution, so I have to use pweibull function. I also know that the shape must be between 0.7 and 0.8.

 pweibull(q, shape, scale = 1, lower.tail = T, log.p = F)

Now here comes the tricky part, for the q parameter, I am required to pass random values calculated via the Weibull inverse, this inverse will have random values between 0 and 1 as input. Does this function work?

pdiweibull(x, q, beta)

Summarizing, if I create a vector of 100 random numbers with values from 0 to 1, pass it to pdiweibull as "x" parameter, and then pass that result to pweibull as "q" parameter, am I translating my thoughts correctly to R code?

¿Fue útil?

Solución

If you are interested in the Weibull distribution, you should not be using the "discrete inverse Weibull distribution", which is something rather different.

Instead just use the four Weibull distribution functions

dweibull(x, shape, scale = 1, log = FALSE)
pweibull(q, shape, scale = 1, lower.tail = TRUE, log.p = FALSE)
qweibull(p, shape, scale = 1, lower.tail = TRUE, log.p = FALSE)
rweibull(n, shape, scale = 1)

for the density, distribution function, quantile function and random values.

rweibull(100, shape=0.75, scale=1) will give a hundred values, perhaps of the form you want, as would qweibull(runif(100), shape=0.75, scale=1) or possibly something like qweibull(x, shape=0.75, scale=1) where x is a vector of 100 random values between 0 and 1

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top