diff --git a/slides/sections/0.md b/slides/sections/0.md index 9170f24..a27f4ef 100644 --- a/slides/sections/0.md +++ b/slides/sections/0.md @@ -1,5 +1,5 @@ --- -title: Title +title: Testing for a Landau distribution date: \today author: - Giulia Marcer @@ -16,9 +16,19 @@ fontsize: 12pt mainfont: Fira Sans mainfontoptions: - BoldFont=Fira Sans - mathfont: FiraMath-Regular +references: + - type: article-journal + id: trapani15 + author: + family: Trapani + given: Lorenzo + title: testing for (in)finite moments + container-title: Journal of Econometrix + issued: + year: 2015 + header-includes: | ```{=latex} %% Colors @@ -32,6 +42,11 @@ header-includes: | \definecolor{yellow}{HTML}{CFB017} \setbeamercolor{frametitle}{bg=mDarkRed} + \definecolor{cyclamen}{RGB}{146,24,43} + + \usepackage{ulem} + \newcommand\strike{\bgroup\markoverwith{% + \textcolor{mDarkRed}{\rule[0.5ex]{2pt}{1pt}}}\ULon} % center images \LetLtxMacro{\oldIncludegraphics}{\includegraphics} @@ -40,6 +55,7 @@ header-includes: | \oldIncludegraphics[#1]{#2} } + % "thus" in formulas \DeclareMathOperator{\thus}{% \hspace{30pt} \Longrightarrow \hspace{30pt} @@ -69,5 +85,9 @@ header-includes: | \DeclareMathOperator{\ob}{% ^{\text{obs}} } + + \setbeamercovered{transparent} ``` + +csl: ../notes/docs/bibliography.csl ... diff --git a/slides/sections/1.md b/slides/sections/1.md index 09783e8..71d689e 100644 --- a/slides/sections/1.md +++ b/slides/sections/1.md @@ -3,24 +3,26 @@ ## Goal -- Generate a sample $L$ of points from a Landau PDF -- Generate a sample $M$ of points from a Moyal PDF +Construct six statistical tests to assert whether a sample comes from a Landau +distribution . . . -- Implement a bunch of statistical tests +- Generate a sample $L$ from a Landau PDF +- Generate a sample $M$ from a Moyal PDF . . . -- Check if they work: - - the sample $L$ truly comes from a Landau PDF - - the sample $M$ does not come from a Landau PDF +$H_0$: sample following Landau PDF + + - can we accept $H_0$ for $L$? + - can we reject $H_0$ for $M$? -## Why? +## Why Moyal? The Landau and Moyal PDFs are really similar. Historically, the latter was -utilized in the approximation of the former. +utilized as an approximation of the former. :::: {.columns} ::: {.column width=33%} @@ -79,15 +81,18 @@ utilized in the approximation of the former. . . . -- Parameters comparison: - - compatibility between expected and observed PDF parameters +- **Properties test**: + + compatibility between expected and observed PDF properties . . . -- Kolmogorov - Smirnov test: - - compatibility between expected and observed CDF +- **Kolmogorov - Smirnov test**: + + compatibility between expected and empirical CDF . . . -- Trapani test: - - compatibility between expected and observed moments +- **Trapani test**: + + test for finite or infinite moments diff --git a/slides/sections/2.md b/slides/sections/2.md index 5e491f6..6c49058 100644 --- a/slides/sections/2.md +++ b/slides/sections/2.md @@ -1,18 +1,24 @@ # Landau PDF -## A pathological distribution +## Landau PDF -Because of its fat tail: +:::: {.columns} +::: {.column width=50% .c} + $$ + L(x) = \frac{1}{\pi} \int \limits_{0}^{+ \infty} + dt \, e^{-t \ln(t) -xt} \sin (\pi t) + $$ +::: -\begin{align*} - E[x] &\longrightarrow + \infty \\ - V[x] &\longrightarrow + \infty -\end{align*} +::: {.column width=50%} + ![](images/landau-pdf.pdf) +::: +:::: . . . -No closed form for parameters $\thus$ numerical estimations +No closed form for \textcolor{cyclamen}{ANYTHING} ## Landau median @@ -28,9 +34,17 @@ $$ - CDF computed by numerical integration - QDF computed by numerical root-finding (Brent) -$$ - m_L\ex = 1.3557804... -$$ +\setbeamercovered{} + +\begin{center} + \begin{tikzpicture}[remember picture] + \node at (0,0) (here) {$m_L\ex = 1.3557804...$}; + \pause + \node [opacity=0.5, xscale=0.35, yscale=0.25 ] at (here) {\includegraphics{images/high.png}}; + \end{tikzpicture} +\end{center} + +\setbeamercovered{transparent} ## Landau mode @@ -41,9 +55,17 @@ $$ - Computed by numerical minimization (Brent) -$$ - \mu_L\ex = − 0.22278... -$$ +\setbeamercovered{} + +\begin{center} + \begin{tikzpicture}[remember picture] + \node at (0,0) (here) {$\mu_L\ex = − 0.22278...$}; + \pause + \node [opacity=0.5, xscale=0.32, yscale=0.25 ] at (here) {\includegraphics{images/high.png}}; + \end{tikzpicture} +\end{center} + +\setbeamercovered{transparent} ## Landau FWHM @@ -62,6 +84,14 @@ $$ - Computed by numerical root finding (Brent) -$$ - w_L\ex = 4.018645... -$$ +\setbeamercovered{} + +\begin{center} + \begin{tikzpicture}[remember picture] + \node at (0,0) (here) {$w_L\ex = 4.018645...$}; + \pause + \node [opacity=0.5, xscale=0.32, yscale=0.25 ] at (here) {\includegraphics{images/high.png}}; + \end{tikzpicture} +\end{center} + +\setbeamercovered{transparent} diff --git a/slides/sections/3.md b/slides/sections/3.md index 430977a..f6b779c 100644 --- a/slides/sections/3.md +++ b/slides/sections/3.md @@ -121,12 +121,8 @@ $$ ## Moyal FWHM $$ - x_+ - x_- = W_0 \left( - \frac{1}{4 e} \right) - - W_{-1} \left( - \frac{1}{4 e} \right) - = 3.590806098... - = a + x_+ - x_- = 3.590806098... = a $$ - \begin{align*} M(z) &\thus w_M^{\text{exp}} = a \\ diff --git a/slides/sections/4.md b/slides/sections/4.md index 1304f4b..bd9b247 100644 --- a/slides/sections/4.md +++ b/slides/sections/4.md @@ -1,34 +1,46 @@ -# Sample parameters estimation +# Sample statistics -## Sample parameters estimation +## Sample statistics -Once the points are sampled, -how to estimate their median, mode and FWHM? +How to estimate sample median, mode and FWHM? . . . -- Binning data $\hence$ result depending on bin-width +- \only<3>\strike{Binning data $\hence$ depends wildly on bin-width} . . . - Alternative solutions + - Robust estimators + - Kernel density estimation ## Sample median -$$ - m = Q \left( \frac{1}{2} \right) -$$ +:::: {.columns} +::: {.column width=50% .c} + $$ + F(m) = \frac{1}{2} + $$ -. . . + \vspace{20pt} -- Sort points in ascending order + . . . -. . . + - Sort points in ascending order -- Middle element if odd -- Average of the two central elements if even + . . . + + - Middle element if odd + + Average of the two central elements if even +::: + +::: {.column width=50%} + ![](images/median.pdf) +::: +:::: ## Sample mode @@ -37,11 +49,78 @@ Most probable value . . . -HSM +Half Sample Mode - Iteratively identify the smallest interval containing half points - Once the sample is reduced to less than three points, take average +. . . + +\setbeamercovered{} + +\begin{center} +\begin{tikzpicture}[remember picture] + % line + \draw [line width=3, ->, cyclamen] (-5,0) -- (5,0); + \node [right] at (5,0) {$x$}; + % points + \draw [blue, fill=blue] (-4.6,-0.1) rectangle (-4.8,0.1); + \draw [blue, fill=blue] (-4,-0.1) rectangle (-4.2,0.1); + \draw [blue, fill=blue] (-3.3,-0.1) rectangle (-3.5,0.1); + \draw [blue, fill=blue] (-2.3,-0.1) rectangle (-2.5,0.1); + \draw [blue, fill=blue] (-0.6,-0.1) rectangle (-0.8,0.1); + \draw [blue, fill=blue] (-0.1,-0.1) rectangle (0.1,0.1); + \draw [blue, fill=blue] (1.1,-0.1) rectangle (1.3,0.1); + \draw [blue, fill=blue] (2 ,-0.1) rectangle (2.2,0.1); + \draw [blue, fill=blue] (2.7,-0.1) rectangle (2.9,0.1); + \draw [blue, fill=blue] (4,-0.1) rectangle (4.2,0.1); + % future nodes + \node at (-1,-0.3) (1a) {}; + \node at (3.1,0.3) (1b) {}; + \node at (0.9,-0.3) (2a) {}; + \node at (1.8,-0.3) (3a) {}; + % result nodes + \node at (2.45,-0.7) (f1) {}; + \node at (2.45,0.7) (f2) {}; +\end{tikzpicture} +\end{center} + +. . . + +\begin{center} +\begin{tikzpicture}[remember picture, overlay] + % region + \draw [orange, fill=orange, opacity=0.5] (1a) rectangle (1b); +\end{tikzpicture} +\end{center} + +. . . + +\begin{center} +\begin{tikzpicture}[remember picture, overlay] + % region + \draw [orange, fill=orange, opacity=0.5] (2a) rectangle (1b); +\end{tikzpicture} +\end{center} + +. . . + +\begin{center} +\begin{tikzpicture}[remember picture, overlay] + % region + \draw [orange, fill=orange, opacity=0.5] (3a) rectangle (1b); +\end{tikzpicture} +\end{center} + +. . . + +\begin{center} +\begin{tikzpicture}[remember picture, overlay] + % region + \draw [cyclamen, ultra thick] (f1) -- (f2); +\end{tikzpicture} +\end{center} + ## Sample FWHM @@ -49,9 +128,10 @@ $$ \text{FWHM} = x_+ - x_- \with L(x_{\pm}) = \frac{L_{\text{max}}}{2} $$ +\setbeamercovered{transparent} . . . -KDE +Kernel Density Estimation - empirical PDF construction: @@ -82,9 +162,9 @@ with: . . . -\vspace{10pt} - -Numerical root finding (Brent) +Numerical minimization (Brent) for $\quad f_{\varepsilon_{\text{max}}}$ +Numerical root finding (Brent) for $\quad f_{\varepsilon}(x_{\pm}) = +\frac{f_{\varepsilon_{\text{max}}}}{2}$ ## Sample FWHM diff --git a/slides/sections/5.md b/slides/sections/5.md index dcb0107..8e20a40 100644 --- a/slides/sections/5.md +++ b/slides/sections/5.md @@ -1,81 +1,43 @@ -# MC simulations +# Kolmogorov - Smirnov test -## In summary +## KS ------------------------------------------------------ - Landau Moyal ------------------ ----------------- ----------------- -median $m_L\ex$ $m_M\ex (μ, σ)$ +Quantify distance between expected and observed CDF -mode $\mu_L\ex$ $\mu_M\ex (μ)$ +. . . -FWHM $w_L\ex$ $w_M\ex (σ)$ ------------------------------------------------------ +KS statistic: - -## Moyal parameters - -A $M(x)$ similar to $L(x)$ can be found by imposing: - -\vspace{15pt} - -- equal mode $$ - \mu_M\ex = \mu_L\ex \approx −0.22278298... + D_N = \text{sup}_x |F_N(x) - F(x)| +$$ + +- $F(x)$ is the expected CDF +- $F_N(x)$ is the empirical CDF of $N$ sampled points + - sort points in ascending order + - number of points preceding the point normalized by $N$ + + +## KS + +$H_0$: points sampled according to $F(x)$ + +. . . + +If $H_0$ is true: + +- $\sqrt{N}D_N \xrightarrow{N \rightarrow + \infty} K$ + +Kolmogorov distribution with CDF: + +$$ + P(K \leqslant K_0) = 1 - p = \frac{\sqrt{2 \pi}}{K_0} + \sum_{j = 1}^{+ \infty} e^{-(2j - 1)^2 \pi^2 / 8 K_0^2} $$ . . . -- equal width -$$ - w_M\ex = w_L\ex = \sigma \cdot a -$$ +a $p$-value can be computed -$$ - \implies \sigma_M \approx 1.1191486... -$$ - - -## Moyal parameters - -:::: {.columns} -::: {.column width=50%} - ![](images/both-pdf-bef.pdf) -::: - -::: {.column width=50%} - ![](images/both-pdf-aft.pdf) -::: -:::: - - -## Moyal parameters - -This leads to more different medians: - -\begin{align*} - m_M = 0.787... \thus &m_M = 0.658... \\ - &m_L = 1.355... -\end{align*} - - -## Compatibility test - -Comparing results: - -$$ - p = 1 - \text{erf} \left( \frac{t}{\sqrt{2}} \right)\ \with - t = \frac{|x\ex - x\ob|}{\sqrt{\sigma\ex^2 + \sigma\ob^2}} -$$ - -- $x\ex$ and $x\ob$ are the expected and observed values -- $\sigma\ex$ and $\sigma\ob$ are their absolute errors - -. . . - -At 95% confidence level, the values are compatible if: - -$$ - p > 0.05 -$$ +- At 95% confidence level, $H_0$ cannot be disproved if $p > 0.05$ diff --git a/slides/sections/6.md b/slides/sections/6.md index 0851093..c045b40 100644 --- a/slides/sections/6.md +++ b/slides/sections/6.md @@ -1,148 +1,181 @@ -# Landau sample +# Trapani test -## Sample +## A pathological distribution -Sample N = 50'000 random points following $L(x)$ +Because of its fat tail: +\begin{align*} + \mu_1 &= \text{E}\left[|x|\right] \longrightarrow + \infty \\ + \mu_2 &= \text{E}\left[|x|^2\right] \longrightarrow + \infty +\end{align*} +. . . + +No closed form for parameters $\thus$ numerical estimations + +. . . + +For a Moyal PDF: +\begin{align*} + E_M[x] &= \mu + \sigma [ \gamma + \ln(2) ] \\ + V_M[x] &= \frac{\pi^2 \sigma^2}{2} +\end{align*} + + +## Infinite moments + +- Check whether a moment is finite or infinite +\begin{align*} + \text{infinite} &\thus Landau \\ + \text{finite} &\thus Moyal +\end{align*} + +. . . + + +# Trapani test + + +## Trapani test + +::: incremental + + - Random variable $\left\{ x_i \right\}$ sampled from a distribution $f$ + - Sample moments according to $f$ moments + - $H_0$: $\mu_k \longrightarrow + \infty$ + - Statistic with 1 dof chi-squared distribution + +::: + + +## Trapani test + +- Start with $\left\{ x_i \right\}^N$ and compute $\mu_k$ as: + $$ + \mu_k = \frac{1}{N} \sum_{i = 1}^N |x_i|^k + $$ + +. . . + +- Generate $r$ points $\left\{ \xi_j\right\}^r$ according to $G(0, 1)$ and define + $\left\{ a_j \right\}^r$ as: + $$ + a_j = \sqrt{e^{\mu_k}} \cdot \xi_j + \thus G'\left( 0, \sqrt{e^{\mu_k}} \right) + $$ + +. . . + +The greater $\mu^k$, the 'larger' $G'$ + +- if $\mu_k \longrightarrow + \infty \thus a_j$ distributed uniformly + + +## Trapani test + +- Define the sequence: $\left\{ \zeta_j (u) \right\}^r$ as: + $$ + \zeta_j (u) = \theta( u - a_j) \with \theta - \text{Heaviside} + $$ + +. . . + +\begin{center} +\begin{tikzpicture} + % line + \draw [line width=3, ->, cyclamen] (0,0) -- (10,0); + \node [right] at (10,0) {$u$}; + % tic + \draw [thick] (5,-0.3) -- (5,0.3); + \node [above] at (5,0.3) {$u_0$}; + % aj tics + \draw [thick, cyclamen] (1,-0.2) -- (1,0.2); + \node [below right, cyclamen] at (1,-0.2) {$a_{j+2}$}; + \draw [thick, cyclamen] (2,-0.2) -- (2,0.2); + \node [below right, cyclamen] at (2,-0.2) {$a_j$}; + \draw [thick, cyclamen] (5.2,-0.2) -- (5.2,0.2); + \node [below right, cyclamen] at (5.2,-0.2) {$a_{j+2}$}; + \draw [thick, cyclamen] (6,-0.2) -- (6,0.2); + \node [below right, cyclamen] at (6,-0.2) {$a_{j+3}$}; + \draw [thick, cyclamen] (8.5,-0.2) -- (8.5,0.2); + \node [below right, cyclamen] at (8.5,-0.2) {$a_{j+4}$}; + % notes + \node [below] at (1,-1) {0}; + \node [below] at (2,-1) {0}; + \node [below] at (5.2,-1) {1}; + \node [below] at (6,-1) {1}; + \node [below] at (8.5,-1) {1}; + \draw [thick, ->] (1,-0.5) -- (1,-1); + \draw [thick, ->] (2,-0.5) -- (2,-1); + \draw [thick, ->] (5.2,-0.5) -- (5.2,-1); + \draw [thick, ->] (6,-0.5) -- (6,-1); + \draw [thick, ->] (8.5,-0.5) -- (8.5,-1); +\end{tikzpicture} +\end{center} + +. . . + +If $a_j$ uniformly distributed and $N \rightarrow + \infty$: + +- $\zeta_j (u)$ Bernoulli PDF with $P(\zeta_j (u) = 1) = \frac{1}{2}$ + + +## Trapani test + +- Define the function $\vartheta (u)$ as: $$ - L(x) = \frac{1}{\pi} \int \limits_{0}^{+ \infty} - dt \, e^{-t \ln(t) -xt} \sin (\pi t) + \vartheta (u) = \frac{2}{\sqrt{r}} + \left[ \sum_{j} \zeta_j (u) - \frac{r}{2} \right] $$ . . . -gsl_ran_Landau(gsl_rng) - - -## Compatibility results: - -Median: - -:::: {.columns} -::: {.column width=50%} - - $t = 0.761$ - - $p = 0.446$ -::: - -::: {.column width=50%} - $$ - \hence \text{Compatible!} - $$ -::: -:::: - -\vspace{10pt} - -. . . - -Mode: - -:::: {.columns} -::: {.column width=50%} - - $t = 1.012$ - - $p = 0.311$ -::: - -::: {.column width=50%} - $$ - \hence \text{Compatible!} - $$ -::: -:::: - -\vspace{10pt} - -. . . - -FWHM: - -:::: {.columns} -::: {.column width=50%} - - $t=1.338$ - - $p=0.181$ -::: - -::: {.column width=50%} - $$ - \hence \text{Compatible!} - $$ -::: -:::: - - -# Moyal sample - - -## Sample - -Sample N = 50'000 random points following $M_{\mu \sigma}(x)$ - +If $a_j$ uniformly distributed and $N \rightarrow + \infty$, for the CLT: $$ - M_{\mu \sigma}(x) = \frac{1}{\sqrt{2 \pi} \sigma} \exp - \left[ - \frac{1}{2} \left( - \frac{x - \mu}{\sigma} - + e^{-\frac{x - \mu}{\sigma}} \right) \right] + \sum_j \zeta_j (u) \hence + G \left( \frac{r}{2}, \frac{r}{4} \right) + \thus \vartheta (u) \hence + G \left( 0, 1 \right) $$ . . . -reverse sampling - -- sampling $y$ uniformly in [0, 1] $\hence x = Q_M(y)$ +- Test statistic: +$$ + \Theta = \int_{\underbar{u}}^{\bar{u}} du \, \vartheta^2 (u) \psi(u) +$$ -## Compatibility results: +## Trapani test -Median: +According to L. Trapani [@trapani15]: -:::: {.columns} -::: {.column width=50%} - - $t = 669.940$ - - $p = 0.000$ -::: - -::: {.column width=50%} - $$ - \hence \text{Not compatible!} - $$ -::: -:::: - -\vspace{10pt} +- $r = o(N) \hence r = N^{0.75}$ +- $\underbar{u} = 1 \quad \wedge \quad \bar{u} = 1$ +- $\psi(u) = \chi_{[\underbar{u}, \bar{u}]}$ . . . -Mode: +$\mu_k$ must be scale invariant for $k > 1$: -:::: {.columns} -::: {.column width=50%} - - $t = 0.732$ - - $p = 0.464$ -::: +$$ + \tilde{\mu_k} = \frac{\mu_k}{ \left( \mu_{\phi} \right)^{k/\phi} } + \with \phi \in (0, k) +$$ -::: {.column width=50%} - $$ - \hence \text{Compatible!} - $$ -::: -:::: -\vspace{10pt} +## Trapani test -. . . +If $\mu_k \ne + \infty \hence \left\{ a_j \right\}$ are not uniformly distributed +\vspace{20pt} +Rewriting: +$$ + \vartheta (u) = \frac{2}{\sqrt{r}} + \left[ \sum_{j} \zeta_j (u) - \frac{r}{2} \right] + = \frac{2}{\sqrt{r}} + \sum_{j} \left[ \zeta_j (u) - \frac{1}{2} \right] +$$ -FWHM: +\vspace{20pt} -:::: {.columns} -::: {.column width=50%} - - $t = 1.329$ - - $p = 0.184$ -::: - -::: {.column width=50%} - $$ - \hence \text{Compatible!} - $$ -::: -:::: +Residues become very large $\hence$ $p$-values decreases. diff --git a/slides/sections/7.md b/slides/sections/7.md index 98a11fc..dcb0107 100644 --- a/slides/sections/7.md +++ b/slides/sections/7.md @@ -1,87 +1,81 @@ -# Kolmogorov - Smirnov test +# MC simulations -## KS +## In summary -Quantify distance between expected and observed CDF +----------------------------------------------------- + Landau Moyal +----------------- ----------------- ----------------- +median $m_L\ex$ $m_M\ex (μ, σ)$ -. . . +mode $\mu_L\ex$ $\mu_M\ex (μ)$ -KS statistic: +FWHM $w_L\ex$ $w_M\ex (σ)$ +----------------------------------------------------- + +## Moyal parameters + +A $M(x)$ similar to $L(x)$ can be found by imposing: + +\vspace{15pt} + +- equal mode $$ - D_N = \text{sup}_x |F_N(x) - F(x)| -$$ - -- $F(x)$ is the expected CDF -- $F_N(x)$ is the empirical CDF of $N$ sampled points - - sort points in ascending order - - number of points preceding the point normalized by $N$ - - -## KS - -$H_0$: points sampled according to $F(x)$ - -. . . - -If $H_0$ is true: - -- $\sqrt{N}D_N \xrightarrow{N \rightarrow + \infty} K$ - -Kolmogorov distribution with CDF: - -$$ - P(K \leqslant K_0) = 1 - p = \frac{\sqrt{2 \pi}}{K_0} - \sum_{j = 1}^{+ \infty} e^{-(2j - 1)^2 \pi^2 / 8 K_0^2} + \mu_M\ex = \mu_L\ex \approx −0.22278298... $$ . . . -a $p$-value can be computed +- equal width +$$ + w_M\ex = w_L\ex = \sigma \cdot a +$$ -- At 95% confidence level, $H_0$ cannot be disproved if $p > 0.05$ +$$ + \implies \sigma_M \approx 1.1191486... +$$ -# Samples results - - -## Samples results - -$N = 50000$ sampled points - -. . . - -Landau sample: +## Moyal parameters :::: {.columns} ::: {.column width=50%} - - $D = 0.004$ - - $p = 0.379$ + ![](images/both-pdf-bef.pdf) ::: ::: {.column width=50%} - $$ - \hence \text{Compatible!} - $$ + ![](images/both-pdf-aft.pdf) ::: :::: -\vspace{10pt} + +## Moyal parameters + +This leads to more different medians: + +\begin{align*} + m_M = 0.787... \thus &m_M = 0.658... \\ + &m_L = 1.355... +\end{align*} + + +## Compatibility test + +Comparing results: + +$$ + p = 1 - \text{erf} \left( \frac{t}{\sqrt{2}} \right)\ \with + t = \frac{|x\ex - x\ob|}{\sqrt{\sigma\ex^2 + \sigma\ob^2}} +$$ + +- $x\ex$ and $x\ob$ are the expected and observed values +- $\sigma\ex$ and $\sigma\ob$ are their absolute errors . . . -Moyal sample: +At 95% confidence level, the values are compatible if: -:::: {.columns} -::: {.column width=50%} - - $D = 0.153$ - - $p = 0.000$ -::: - -::: {.column width=50%} - $$ - \hence \text{Not compatible!} - $$ -::: -:::: +$$ + p > 0.05 +$$ diff --git a/slides/sections/8.md b/slides/sections/8.md index b89500f..fbe10db 100644 --- a/slides/sections/8.md +++ b/slides/sections/8.md @@ -1,184 +1,198 @@ -# Trapani test +# Landau sample -## Infinite moments +## Sample -For a Landau PDF: -\begin{align*} - E_L[x] &\longrightarrow + \infty \\ - V_L[x] \text{undefined} -\end{align*} +Sample N = 50'000 random points following $L(x)$ + +$$ + L(x) = \frac{1}{\pi} \int \limits_{0}^{+ \infty} + dt \, e^{-t \ln(t) -xt} \sin (\pi t) +$$ . . . -For a Moyal PDF: -\begin{align*} - E_M[x] &= \mu + \sigma [ \gamma + \ln(2) ] \\ - V_M[x] &= \frac{\pi^2 \sigma^2}{2} -\end{align*} +gsl_ran_Landau(gsl_rng) -## Infinite moments +## Compatibility results: -- Check whether a moment is finite or infinite -\begin{align*} - \text{infinite} &\thus Landau \\ - \text{finite} &\thus Moyal -\end{align*} - -. . . - - -# Trapani test - - -## Trapani test - -::: incremental - - - Random variable $\left\{ x_i \right\}$ sampled from a distribution $f$ - - Sample moments according to $f$ moments - - $H_0$: $\mu_k \longrightarrow + \infty$ - - Statistic with 1 dof chi-squared distribution +Median: +:::: {.columns} +::: {.column width=50%} + - $t = 0.761$ + - $p = 0.446$ ::: - -## Trapani test - -- Start with $\left\{ x_i \right\}^N$ and compute $\mu_k$ as: +::: {.column width=50%} $$ - \mu_k = \frac{1}{N} \sum_{i = 1}^N |x_i|^k + \hence \text{Compatible!} $$ +::: +:::: + +\vspace{10pt} . . . -- Generate $r$ points $\left\{ \xi_j\right\}^r$ according to $G(0, 1)$ and define - $\left\{ a_j \right\}^r$ as: +Mode: + +:::: {.columns} +::: {.column width=50%} + - $t = 1.012$ + - $p = 0.311$ +::: + +::: {.column width=50%} $$ - a_j = \sqrt{e^{\mu_k}} \cdot \xi_j - \thus G'\left( 0, \sqrt{e^{\mu_k}} \right) + \hence \text{Compatible!} $$ +::: +:::: + +\vspace{10pt} . . . -The greater $\mu^k$, the 'larger' $G'$ +FWHM: -- if $\mu_k \longrightarrow + \infty \thus a_j$ distributed uniformly +:::: {.columns} +::: {.column width=50%} + - $t=1.338$ + - $p=0.181$ +::: - -## Trapani test - -- Define the sequence: $\left\{ \zeta_j (u) \right\}^r$ as: +::: {.column width=50%} $$ - \zeta_j (u) = \theta( u - a_j) \with \theta - \text{Heaviside} + \hence \text{Compatible!} $$ - -. . . - -\begin{center} -\begin{tikzpicture} - \definecolor{cyclamen}{RGB}{146,24,43} - % line - \draw [line width=3, ->, cyclamen] (0,0) -- (10,0); - \node [right] at (10,0) {$u$}; - % tic - \draw [thick] (5,-0.3) -- (5,0.3); - \node [above] at (5,0.3) {$u_0$}; - % aj tics - \draw [thick, cyclamen] (1,-0.2) -- (1,0.2); - \node [below right, cyclamen] at (1,-0.2) {$a_{j+2}$}; - \draw [thick, cyclamen] (2,-0.2) -- (2,0.2); - \node [below right, cyclamen] at (2,-0.2) {$a_j$}; - \draw [thick, cyclamen] (5.2,-0.2) -- (5.2,0.2); - \node [below right, cyclamen] at (5.2,-0.2) {$a_{j+2}$}; - \draw [thick, cyclamen] (6,-0.2) -- (6,0.2); - \node [below right, cyclamen] at (6,-0.2) {$a_{j+3}$}; - \draw [thick, cyclamen] (8.5,-0.2) -- (8.5,0.2); - \node [below right, cyclamen] at (8.5,-0.2) {$a_{j+4}$}; - % notes - \node [below] at (1,-1) {0}; - \node [below] at (2,-1) {0}; - \node [below] at (5.2,-1) {1}; - \node [below] at (6,-1) {1}; - \node [below] at (8.5,-1) {1}; - \draw [thick, ->] (1,-0.5) -- (1,-1); - \draw [thick, ->] (2,-0.5) -- (2,-1); - \draw [thick, ->] (5.2,-0.5) -- (5.2,-1); - \draw [thick, ->] (6,-0.5) -- (6,-1); - \draw [thick, ->] (8.5,-0.5) -- (8.5,-1); -\end{tikzpicture} -\end{center} - -. . . - -If $a_j$ uniformly distributed and $N \rightarrow + \infty$: - -- $\zeta_j (u)$ Bernoulli PDF with $P(\zeta_j (u) = 1) = \frac{1}{2}$ +::: +:::: -## Trapani test +# Moyal sample + + +## Sample + +Sample N = 50'000 random points following $M_{\mu \sigma}(x)$ -- Define the function $\vartheta (u)$ as: $$ - \vartheta (u) = \frac{2}{\sqrt{r}} - \left[ \sum_{j} \zeta_j (u) - \frac{r}{2} \right] + M_{\mu \sigma}(x) = \frac{1}{\sqrt{2 \pi} \sigma} \exp + \left[ - \frac{1}{2} \left( + \frac{x - \mu}{\sigma} + + e^{-\frac{x - \mu}{\sigma}} \right) \right] $$ . . . -If $a_j$ uniformly distributed and $N \rightarrow + \infty$, for the CLT: -$$ - \sum_j \zeta_j (u) \hence - G \left( \frac{r}{2}, \frac{r}{4} \right) - \thus \vartheta (u) \hence - G \left( 0, 1 \right) -$$ +reverse sampling + +- sampling $y$ uniformly in [0, 1] $\hence x = Q_M(y)$ + + +## Compatibility results: + +Median: + +:::: {.columns} +::: {.column width=50%} + - $t = 669.940$ + - $p = 0.000$ +::: + +::: {.column width=50%} + $$ + \hence \text{Not compatible!} + $$ +::: +:::: + +\vspace{10pt} . . . -- Test statistic: -$$ - \Theta = \int_{\underbar{u}}^{\bar{u}} du \, \vartheta^2 (u) \psi(u) -$$ +Mode: +:::: {.columns} +::: {.column width=50%} + - $t = 0.732$ + - $p = 0.464$ +::: -## Trapani test +::: {.column width=50%} + $$ + \hence \text{Compatible!} + $$ +::: +:::: -According to L. Trapani (10.1016/j.jeconom.2015.08.006): - -- $r = o(N) \hence r = N^{0.75}$ -- $\underbar{u} = 1 \quad \wedge \quad \bar{u} = 1$ -- $\psi(u) = \chi_{[\underbar{u}, \bar{u}]}$ +\vspace{10pt} . . . -$\mu_k$ must be scale invariant for $k > 1$: +FWHM: -$$ - \tilde{\mu_k} = \frac{\mu_k}{ \left( \mu_{\phi} \right)^{k/\phi} } - \with \phi \in (0, k) -$$ +:::: {.columns} +::: {.column width=50%} + - $t = 1.329$ + - $p = 0.184$ +::: + +::: {.column width=50%} + $$ + \hence \text{Compatible!} + $$ +::: +:::: -## Trapani test - -If $\mu_k \ne + \infty \hence \left\{ a_j \right\}$ are not uniformly distributed -\vspace{20pt} -Rewriting: -$$ - \vartheta (u) = \frac{2}{\sqrt{r}} - \left[ \sum_{j} \zeta_j (u) - \frac{r}{2} \right] - = \frac{2}{\sqrt{r}} - \sum_{j} \left[ \zeta_j (u) - \frac{1}{2} \right] -$$ - -\vspace{20pt} - -Residues become very large $\hence$ $p$-values decreases. +# KS results -# Samples results +## Samples results + +$N = 50000$ sampled points + +. . . + +Landau sample: + +:::: {.columns} +::: {.column width=50%} + - $D = 0.004$ + - $p = 0.379$ +::: + +::: {.column width=50%} + $$ + \hence \text{Compatible!} + $$ +::: +:::: + +\vspace{10pt} + +. . . + +Moyal sample: + +:::: {.columns} +::: {.column width=50%} + - $D = 0.153$ + - $p = 0.000$ +::: + +::: {.column width=50%} + $$ + \hence \text{Not compatible!} + $$ +::: +:::: + + +# Trapani results ## Samples results