rstatisticsprobabilityweibull

Calculate CDF of Weibull distribution in R


I want to calculate the probability that a Weibull random variable X is greater than 1000, where X ~ Weibull(lambda, g).

Using the CDF I calculate it as:

g = log(log(.7)/log(.5))/log(40/81)
lambda = -log(.7)/400^g

> exp(-lambda*1000^g)
[1] 0.4294352

but using the R package as below, the result is different

> pweibull(1000, shape = g, scale= lambda, lower.tail = FALSE)
[1] 0

Why are the results different? Am I using the R package wrong?


Solution

  • From the Wikipedia page. https://en.wikipedia.org/wiki/Weibull_distribution#Density_function. It looks like you are using the first alternative of alternative parameterization.

    Following the article, your lambda value is actually "B". To convert to the standard lambda, the conversion is:

    lambdaNew <- exp(-log(lambda)/g)
    

    Thus the R function becomes:

    pweibull(1000, g, lambdaNew, lower.tail = FALSE)
    # [1] 0.4294352