# Fitting a truncated distribution

**URL:** https://discourse.julialang.org/t/fitting-a-truncated-distribution/125067
**Category:** Specific Domains
**Tags:** fit, distributions
**Created:** [January 22, 2025, 10:33am UTC](https://discourse.julialang.org/t/fitting-a-truncated-distribution/125067 "2025-01-22T10:33:22Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![johannesnauta](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johannesnauta/32/47434_2.png) [@johannesnauta](https://discourse.julialang.org/u/johannesnauta)
#### Post date: [January 22, 2025, 10:33am UTC](https://discourse.julialang.org/t/fitting-a-truncated-distribution/125067/1 "2025-01-22T10:33:22Z")

</div>

In `Distributions.jl`, is there no build-in functionality to fit truncated distributions? Of course I can write a small routine to do this, but either I cannot find documentation on it, or it is perhaps not implemented? If the answer is the latter, is there a good reason for this?

In essence, what I am trying to do is

```julia
julia> truncnorm = truncated(Normal(0,1), lower=0.0)
Truncated(Normal{Float64}(μ=0.0, σ=1.0); lower=0.0)

julia> xsamples = rand(truncnorm, 10_000);

julia> fit(Truncated(Normal{Float64}; lower=0.0))
ERROR: MethodError: no method matching Truncated(::Type{Normal{Float64}}; lower::Float64)

```
