---
title: "Finding the Best Fitting Parameters using Optimisation"
canonical: "https://modelassist.epixanalytics.com/space/EA/26575325/Finding%20the%20Best%20Fitting%20Parameters%20using%20Optimisation"
format: markdown
---
The model [Rayleigh Fit](#Rayleigh_fit) is made to find the parameter of a [Rayleigh distribution](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26575252/) that will best match its observed 18 data points. The resultant graph of the model is shown below:

 

![image](media://26ab7aea-ae7e-421f-9cf5-f233b0cd4079)

 

The cumulative distribution function for a Rayleigh distribution *F(x)* is:

 

![image](media://68826bae-aa65-416d-b545-313587e77869)

> Macro (mathblock)

 

where *b* is the distribution's parameter.

> Macro (anchor)



The links to the Rayleigh Fit software specific models are provided here:

<details>
<summary>Crystal Ball</summary>

> Macro (inline-media-image)

 [Rayleigh_fit](/wiki/download/attachments/26579343/Rayleigh_fit-CB.xlsx?version=1&modificationDate=1506113502000&cacheVersion=1&api=v2)

 

Here is a screenshot of the model: 

![image489.gif](media://852f91b7-9540-4a5e-b7ca-2eec21e43023)

  

The Solver feature in Excel is set to find the minimum value for the sum of the absolute differences between the observed and Rayleigh *F(x)*s by changing the value of *b*. The Solver solution for *b* is 4.51195, corresponding to the fit shown in the chart. This technique is very flexible in that it allows one to define one's own measure of goodness of fit. In this example, we have simply taken the sum of absolute differences between the observed and fitted cumulative distribution functions, but we could have weighted the differences at the tails if we were concerned about the tail accuracy more than the body of the distribution. We could also have [maximized a likelihood calculation to obtain MLEs](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26575326/). The example given here is also rather simple in that the Rayleigh distribution is defined by the one parameter. Many distributions have two or more parameters, but if one is careful in putting constraints on the parameter ranges to be tested, Solver will usually handle at least two parameters well. More sophisticated non-linear optimisers could be considered for more complicated problems.
</details>

<details>
<summary>@Risk</summary>

> Macro (inline-media-image)

 [Rayleigh_fit](/wiki/download/attachments/26581760/Rayleigh_fit-AtRISK.xlsx?version=1&modificationDate=1506097522000&cacheVersion=1&api=v2)

 

Here is a screenshot of the model:

![image489.gif](media://852f91b7-9540-4a5e-b7ca-2eec21e43023)

The Solver feature in Excel is set to find the minimum value for the sum of the absolute differences between the observed and Rayleigh *F(x)*s by changing the value of *b*. The Solver solution for *b* is 4.51195, corresponding to the fit shown in the chart. This technique is very flexible in that it allows one to define one's own measure of goodness of fit. In this example, we have simply taken the sum of absolute differences between the observed and fitted cumulative distribution functions, but we could have weighted the differences at the tails if we were concerned about the tail accuracy more than the body of the distribution. We could also have [maximized a likelihood calculation to obtain MLEs](https://epixanalytics.atlassian.net/wiki/spaces/EA/pages/26575326/). The example given here is also rather simple in that the Rayleigh distribution is defined by the one parameter. Many distributions have two or more parameters, but if one is careful in putting constraints on the parameter ranges to be tested, Solver will usually handle at least two parameters well. More sophisticated non-linear optimisers could be considered for more complicated problems.
</details>

  


---