# Creating a new distribution: 3-parameter Weibull

**URL:** <https://discourse.julialang.org/t/creating-a-new-distribution-3-parameter-weibull/55538>\
**Category:** Statistics\
**Tags:** package, distributions\
**Created:** [February 18, 2021, 1:01pm UTC](https://discourse.julialang.org/t/creating-a-new-distribution-3-parameter-weibull/55538 "2021-02-18T13:01:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Staab](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/peter_staab/32/5874_2.png) [@Peter\_Staab](https://discourse.julialang.org/u/Peter_Staab)\
**Post date:** [February 18, 2021, 1:01pm UTC](https://discourse.julialang.org/t/creating-a-new-distribution-3-parameter-weibull/55538/1 "2021-02-18T13:01:32Z")

</div>

I have been working with a 3-parameter Weibull, which can be found [at the Weibull wikipedia site](https://en.wikipedia.org/wiki/Weibull_distribution). I’m working to get a pull request to add to the Distributions.jl library. I have two somewhat unrelated questions:

1. should I create a new struct (Weibull3) or try to incorporate it in the existing Weibull code in weibull.jl? Currently I have a version with a new struct called `Weibull3` that returns a `Weibull` when the third parameter is 0.
2. upon testing it, it won’t plot a distribution of this type, although the `pdf` function is working. There’s a

```julia
MethodError: no method matching iterate(::Weibull3{Float64})

```

Is there anything else that I’d need to add to get this working? I can post code, but just curious if there is something obvious I’m missing.

Planning to submit a PR as soon as I can iron out a couple of other items.

---

<div class="post-metadata">

**Author:** ![johnczito](https://avatars.discourse-cdn.com/v4/letter/j/53a042/32.png) [@johnczito](https://discourse.julialang.org/u/johnczito)\
**Post date:** [February 18, 2021, 7:16pm UTC](https://discourse.julialang.org/t/creating-a-new-distribution-3-parameter-weibull/55538/2 "2021-02-18T19:16:23Z")

</div>

Heads up that this functionality is already provided for with [`LocationScale`](https://juliastats.org/Distributions.jl/stable/univariate/#Distributions.LocationScale). It would look something like this:

```julia
using Distributions

k = 1.5
λ = 1
θ = 3
weibull2 = Weibull(k, λ)
weibull3 = LocationScale(θ, 1, weibull2)

```

---

<div class="post-metadata">

**Author:** ![Peter\_Staab](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/peter_staab/32/5874_2.png) [@Peter\_Staab](https://discourse.julialang.org/u/Peter_Staab)\
**Post date:** [February 18, 2021, 7:36pm UTC](https://discourse.julialang.org/t/creating-a-new-distribution-3-parameter-weibull/55538/3 "2021-02-18T19:36:14Z")

</div>

Good to know.
