1
$\begingroup$
data = {1.312, 1.314, 1.479, 1.552, 1.700, 1.803, 1.861, 1.865, 1.944, 1.958, 1.966, 1.997, 2.006, 2.021, 2.027, 2.055, 2.063, 2.098, 2.14, 2.179, 2.224, 2.240, 2.253, 2.270, 2.272, 2.274, 2.301, 2.301, 2.359, 2.382, 2.382, 2.426, 2.434, 2.435, 2.478, 2.490, 2.511, 2.514, 2.535, 2.554, 2.566, 2.57, 2.586, 2.629, 2.633, 2.642, 2.648, 2.684, 2.697, 2.726, 2.770, 2.773, 2.800, 2.809, 2.818, 2.821, 2.848, 2.88, 2.954, 3.012, 3.067, 3.084, 3.090, 3.096, 3.128, 3.233, 3.433, 3.585, 3.585}; 

I constructed a basic Pareto distribution and fitted it to the data to obtain the best-fit value of the distribution parameter $\lambda$:

dist = ProbabilityDistribution[{"CDF", 1 - x^(-\[Lambda])}, {x, 0, \[Infinity]}, Assumptions -> {\[Lambda] > 0}] mle = FindDistributionParameters[data, dist] 

This returned {\[Lambda] -> 1.14273}

I then wanted to plot fitted vs predicted values so I tried ProbabilityScalePlot[data, dist] but it returned an error:

an error

I ultimately want to calculate this DistributionFitTest[data, dist, {"TestDataTable", "AndersonDarling"}]: enter image description here

I would like to use my custom distribution, rather than a built-in from Mathematica, and i want to plot its empirical CDF.

$\endgroup$
2
  • $\begingroup$ Your custom distribution is equivalent to the built-in ParetoDistribution[1, lambda]. Have you tried using that? $\endgroup$ Commented Mar 13, 2022 at 15:20
  • $\begingroup$ no i want to write my custom distribution in mathematica $\endgroup$ Commented Mar 13, 2022 at 15:56

1 Answer 1

1
$\begingroup$
data = {1.312, 1.314, 1.479, 1.552, 1.700, 1.803, 1.861, 1.865, 1.944, 1.958, 1.966, 1.997, 2.006, 2.021, 2.027, 2.055, 2.063, 2.098, 2.14, 2.179, 2.224, 2.240, 2.253, 2.270, 2.272, 2.274, 2.301, 2.301, 2.359, 2.382, 2.382, 2.426, 2.434, 2.435, 2.478, 2.490, 2.511, 2.514, 2.535, 2.554, 2.566, 2.57, 2.586, 2.629, 2.633, 2.642, 2.648, 2.684, 2.697, 2.726, 2.770, 2.773, 2.800, 2.809, 2.818, 2.821, 2.848, 2.88, 2.954, 3.012, 3.067, 3.084, 3.090, 3.096, 3.128, 3.233, 3.433, 3.585, 3.585}; dist[λ_] = ProbabilityDistribution[{"CDF", 1 - x^(-λ)}, {x, 1, ∞}]; Λ = λ /. FindDistributionParameters[data, dist[λ]] (* 1.14273 *) ProbabilityPlot[data, dist[Λ]] 

enter image description here

DistributionFitTest[data, dist[Λ], {"TestDataTable", "AndersonDarling"}] 

$$ \begin{array}{l|ll} \text{} & \text{Statistic} & \text{P-Value} \\ \hline \text{Anderson-Darling} & 18.343 & \text{8.698112014204895$\grave{ }$*${}^{\wedge}$-6} \\ \end{array} $$

Notes:

I've modified the domain of the given CDF to $[1,\infty)$ so that it stays within the required range $[0,1]$.

The empirical distribution is EmpiricalDistribution[data]:

datacdf[x_] = CDF[datadist][x]; Plot[datacdf[x], {x, 1, 4}, PlotPoints -> 100] 

enter image description here

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.