# Twisting properties

Twisting properties in general terms are associated with the properties of samples that identify with statistics that are suitable for exchange.

## Description

Starting with a sample $\{x_{1},\ldots ,x_{m}\}$ observed from a random variable X having a given distribution law with a non-set parameter, a parametric inference problem consists of computing suitable values – call them estimates – of this parameter precisely on the basis of the sample. An estimate is suitable if replacing it with the unknown parameter does not cause major damage in next computations. In algorithmic inference, suitability of an estimate reads in terms of compatibility with the observed sample.
In turn, parameter compatibility is a probability measure that we derive from the probability distribution of the random variable to which the parameter refers. In this way we identify a random parameter Θ compatible with an observed sample. Given a sampling mechanism $M_{X}=(g_{\theta },Z)$, the rationale of this operation lies in using the Z seed distribution law to determine both the X distribution law for the given θ, and the Θ distribution law given an X sample. Hence, we may derive the latter distribution directly from the former if we are able to relate domains of the sample space to subsets of Θ support. In more abstract terms, we speak about twisting properties of samples with properties of parameters and identify the former with statistics that are suitable for this exchange, so denoting a well behavior w.r.t. the unknown parameters. The operational goal is to write the analytic expression of the cumulative distribution function $F_{\Theta }(\theta )$, in light of the observed value s of a statistic S, as a function of the S distribution law when the X parameter is exactly θ.

## Method

Given a sampling mechanism $M_{X}=(g_{\theta },Z)$ for the random variable X, we model ${\boldsymbol {X}}=\{X_{1},\ldots ,X_{m}\}$ to be equal to $\{g_{\theta }(Z_{1}),\ldots ,g_{\theta }(Z_{m})\}$. Focusing on a relevant statistic $S=h_{1}(X_{1},\ldots ,X_{m})$ for the parameter θ, the master equation reads
    $s=h(g_{\theta }(z_{1}),\ldots ,g_{\theta }(z_{m}))=\rho (\theta ;z_{1},\ldots ,z_{m}).$
When s is a well-behaved statistic w.r.t the parameter, we are sure that a monotone relation exists for each ${\boldsymbol {z}}=\{z_{1},\ldots ,z_{m}\}$ between s and θ. We are also assured that Θ, as a function of ${\boldsymbol {Z}}$ for given s, is a random variable since the master equation provides solutions that are feasible and independent of other (hidden) parameters.
The direction of the monotony determines for any ${\boldsymbol {z}}$ a relation between events of the type $s\geq s'\leftrightarrow \theta \geq \theta '$ or vice versa $s\geq s'\leftrightarrow \theta \leq \theta '$, where $s'$ is computed by the master equation with $\theta '$. In the case that s assumes discrete values the first relation changes into $s\geq s'\rightarrow \theta \geq \theta '\rightarrow s\geq s'+\ell$ where $\ell >0$ is the size of the s discretization grain, idem with the opposite monotony trend. Resuming these relations on all seeds, for s continuous we have either
    $F_{\Theta \mid S=s}(\theta )=F_{S\mid \Theta =\theta }(s)$
or
    $F_{\Theta \mid S=s}(\theta )=1-F_{S\mid \Theta =\theta }(s)$
For s discrete we have an interval where $F_{\Theta \mid S=s}(\theta )$ lies, because of $\ell >0$. The whole logical contrivance is called a twisting argument. A procedure implementing it is as follows.

## Algorithm

* Generating a parameter distribution law through a twisting argument
* Given a sample $\{x_{1},\ldots ,x_{m}\}$ from a random variable with parameter θ unknown,
* Identify a well behaving statistic S for the parameter θ and its discretization grain $\ell$ (if any);
* decide the monotony versus;
* compute $F_{\Theta }(\theta )\in \left(q_{1}(F_{S|\Theta =\theta }(s)),q_{2}(F_{S|\Theta =\theta }(s))\right)$ where:
* if S is continuous $q_{1}=q_{2}$
* if S is discrete
* $q_{2}(F_{S}(s))=q_{1}(F_{S}(s-\ell )$ if s does not decrease with θ
* $q_{1}(F_{S}(s))=q_{2}(F_{S}(s-\ell )$ if s does not increase with θ and
* $q_{i}(F_{S})=1-F_{S}$ if s does not decrease with θ and $q_{i}(F_{S})=F_{S}$ if s does not increase with θ for $i=1,2$.

## Remark

The rationale behind twisting arguments does not change when parameters are vectors, though some complication arises from the management of joint inequalities. Instead, the difficulty of dealing with a vector of parameters proved to be the Achilles heel of Fisher's approach to the fiducial distribution of parameters. Also Fraser’s constructive probabilities devised for the same purpose do not treat this point completely.

## Example

For ${\boldsymbol {x}}$ drawn from a gamma distribution, whose specification requires values for the parameters λ and k, a twisting argument may be stated by following the below procedure. Given the meaning of these parameters we know that
    $(k\leq k')\leftrightarrow (s_{k}\leq s_{k'}){\text{ for fixed }}\lambda ,$
    $(\lambda \leq \lambda ')\leftrightarrow (s_{\lambda '}\leq s_{\lambda }){\text{ for fixed }}k,$
where $s_{k}=\prod _{i=1}^{m}x_{i}$ and $s_{\lambda }=\sum _{i=1}^{m}x_{i}$. This leads to a joint cumulative distribution function
    $F_{\Lambda ,K}(\lambda ,k)=F_{\Lambda \,\mid \,K=k}(\lambda )F_{K}(k)=F_{K\,\mid \,\Lambda =\lambda }(k)F_{\Lambda }(\lambda ).$
Using the first factorization and replacing $s_{k}$ with $r_{k}={\frac {s_{k}}{s_{\lambda }^{m}}}$ in order to have a distribution of $K$ that is independent of $\Lambda$, we have
    $F_{\Lambda \,\mid \,K=k}(\lambda )=1-{\frac {\Gamma (km,\lambda s_{\Lambda })}{\Gamma (km)}}$
    $F_{K}(k)=1-F_{R_{k}}(r_{K})$
with m denoting the sample size, $s_{\Lambda }$ and $r_{K}$ are the observed statistics (hence with indices denoted by capital letters), $\Gamma (a,b)$ the incomplete gamma function and $F_{R_{k}}(r_{K})$ the Fox's H function that can be approximated with a gamma distribution again with proper parameters (for instance estimated through the method of moments) as a function of k and m.
With a sample size $m=30,s_{\Lambda }=72.82$ and $r_{K}=$ $4.5\times 10^{-46}$, you may find the joint p.d.f. of the Gamma parameters K and $\Lambda$ on the left. The marginal distribution of K is reported in the picture on the right.