Weibull Distribution in R Calculator

Estimate Weibull measures with formulas and visual insights. Compare density, distribution, quantiles, and random samples. Export clean results for study, audits, reporting, and reuse.

Calculator Inputs

The page uses a single-column flow, while the form fields use 3 columns on large screens, 2 on smaller screens, and 1 on mobile.

Reset

Formula Used

Density:
f(x) = (k / λ) (x / λ)k-1 e-(x/λ)k, for x ≥ 0
Distribution:
F(x) = 1 - e-(x/λ)k
Survival and hazard:
S(x) = e-(x/λ)k
h(x) = f(x) / S(x)
Quantile:
Q(p) = λ[-ln(1 - p)]1/k for lower-tail probabilities
Moments:
E(X) = λΓ(1 + 1/k)
Var(X) = λ²[Γ(1 + 2/k) - Γ²(1 + 1/k)]

How to Use This Calculator

  1. Enter the x value where you want the density, probability, and hazard.
  2. Enter the Weibull shape and scale parameters.
  3. Type a probability for the quantile calculation. Enable log mode if your probability is already logged.
  4. Choose whether you want the lower tail or upper tail interpretation.
  5. Set a random sample size and seed if you want simulated values like rweibull().
  6. Submit the form to view results above the form, graph traces, R-style function calls, and export buttons.

Example Data Table

Illustrative values using shape = 1.8 and scale = 12.

x Shape Scale PDF CDF Survival
5 1.8 12 0.060547 0.186845 0.813155
10 1.8 12 0.063089 0.513362 0.486638
15 1.8 12 0.040240 0.775595 0.224405
20 1.8 12 0.018381 0.918569 0.081431

Mean and Variance of Weibull Distribution Proof

Start with the density f(x) = (k/λ)(x/λ)^(k-1)e^(-(x/λ)^k). For the r-th raw moment, compute E(X^r) = ∫ x^r f(x) dx from 0 to ∞.

Substitute y = (x/λ)^k. Then x = λy^(1/k) and dx = (λ/k)y^(1/k - 1)dy. After simplification, the integral becomes λ^r ∫ y^(r/k)e^-y dy.

That integral is the gamma function, so E(X^r) = λ^r Γ(1 + r/k). Setting r = 1 gives the mean: E(X) = λΓ(1 + 1/k).

Setting r = 2 gives E(X²) = λ²Γ(1 + 2/k). Therefore, Var(X) = E(X²) - [E(X)]² = λ²[Γ(1 + 2/k) - Γ²(1 + 1/k)].

FAQs

1. What does the shape parameter control?

The shape parameter controls the curve form and failure pattern. Values below 1 suggest decreasing hazard, 1 gives a constant hazard, and values above 1 produce an increasing hazard over time.

2. What does the scale parameter mean?

The scale parameter stretches or compresses the distribution horizontally. Larger scale values move the distribution to the right and increase typical lifetimes, lengths, or waiting times.

3. How is this related to R functions?

This calculator mirrors the core R workflow: dweibull() for density, pweibull() for cumulative probability, qweibull() for quantiles, and rweibull() for simulation.

4. Why would I use upper-tail probability?

Upper-tail probability is useful in reliability and survival work. It returns the chance that a value exceeds x, which is often interpreted as remaining life or survival beyond a threshold.

5. Why can the mode be zero?

When the shape is less than or equal to 1, the density is highest at the left boundary. In that case, the most likely value occurs at zero, so the mode is reported as 0.

6. What is the hazard rate here?

The hazard rate is the instantaneous event rate at x, given survival up to x. It equals density divided by survival and is widely used in reliability, maintenance, and time-to-failure analysis.

7. Why generate random Weibull samples?

Random samples help compare theory with simulation. They are useful for teaching, Monte Carlo checks, stress testing, and exploring how sample means vary around the theoretical mean.

8. What do the CSV and PDF exports include?

The CSV export includes inputs, computed outputs, and simulated samples. The PDF export captures the visible result area, including summary cards, tables, and charts for quick sharing or records.

Related Calculators

paired vs unpaired t testgamma distribution calculatordiscrete histogram maker

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.