KeelinPropertyFromA
New to Analytica 6.6
KeelinPropertyFromA( a, K, property, arg1, arg2, resultIndex )
KeelinPropertyFromA returns a requested statistic or property of the (untransformed) Keelin (MetaLog) distribution from its «a» coefficients, where «a» is indexed by «K». The «property» requested is computed analytically (i.e., via a closed-form formula), and thus is not subject to sampling error.
The «a» vector of coefficients is obtained from the KeelinCoefficients function.
In general, the properties obtained from KeelinPropertyFromA apply only to the untransformed Keelin MetaLog distribution. If you are using a bounded- or semi-bounded- Keelin MetaLog via the Logit or Log transformations (as outlined in Tom Keelin's original paper on the MetaLog distribution) then the properties returned by KeelinPropertyFromA don't necessarily apply (they apply to the underlying unbounded transformed dist). If you are using direct bounds in an untransformed version, then these properties do apply. (See Bounds treatments).
Many of the possible properties have no additional parameters and return a scalar value, and hence don't use the optional parameters. For example:
KeelinPropertyFromA( a, K, "Variance" )
Some properties have one or two additional parameters. An example is partial expectation":
- [math]\displaystyle{ E[ x | x_0 \lt x \lt x_1 ] = {{\int_{p_0}^{p_1} M(p) dp}\over {p_1 - p_0}} }[/math]
where [math]\displaystyle{ p_0 = M^{-1}(x_0) }[/math] and [math]\displaystyle{ p_1 = M^{-1}(x_1) }[/math], which requires two parameters and is hence called using
KeelinPropertyFromA( a, K, "Partial expectation", x0, x1 )
Some properties return a vector, in which case you can specify the optional «resultIndex». If you omit it, it defaults to «K», which in some cases might not be long enough. When «resultIndex» is longer than needed, the result is Null-padded. An example that returns a vector is
KeelinPropertyFromA( a, K, "modes", resultIndex: Mode_idx )
Possible values for «property»
Basic statistics and moments
"Mean""Median""Sdeviation""Variance""Skewness""Kurtosis": Returns the excess kurtosis, [math]\displaystyle{ \sum_i \left({x-\bar{x}}\over\sigma\right)^4 - 3 }[/math]"Central moment": Returns the nth central momentKeelinPropertyFromA( a, K, "Central moment", n )
"Standardized moment": Returns the nth standardized momentKeelinPropertyFromA( a, K, "Standardized moment", n)
Partial expectation
One of the really nice properties of the Keelin distribution is that there is a closed form expression for its partial expectation.
"Partial expectation"KeelinPropertyFromA( a, K, "Partial expectation", p0, p1)
- returns [math]\displaystyle{ E[x|p_0\lt p\lt p_1] }[/math], where [math]\displaystyle{ p }[/math] is the cumulative probability, with [math]\displaystyle{ 0\lt p_0\lt p_1\lt 1 }[/math].
"Partial expectation X"KeelinPropertyFromA( a, K, "Partial expectation x", x0, x1)
- returns [math]\displaystyle{ E[x|x_0\lt x\lt x_1] }[/math]
Derivatives, roots and modes
"modes": The modes of the distribution, indexed by «resultIndex» if specified, or «K» if «resultIndex» is not specified.- The interior antimodes are returned in a second return value with the same index.
- To capture both using an index Mode_idx, use:
Local (modes, antimodes):=KeelinPropertyFromA( a, K, "modes", resultIndex:Mode_idx );
"modes p": The cumulative probability location of the modes of the distribution.- Used similarly to "modes" but the resulting values are probabilities rather than values.
"roots": The roots of the nth derivative of the quantile function.- The result is indexed by «resultIndex» (which defaults to «K» if not specified). For higher-order derivatives, an index longer than «K» is sometimes required (2*IndexLength(K) is usually sufficient).
- For example, the extrema and inflection points of the PDF are the roots of the second derivative:
KeelinPropertyFromA( a, K, "roots", 2, resultIndex:Roots_idx )
"derivative coefficients": The nth derivative of the quantile function can be written in a closed form, and this option returns the coefficients for that form.- Let M(y) denote the quantile function, and [math]\displaystyle{ M^(n)(y) }[/math] be the nth derivative. The function
- [math]\displaystyle{ G^(n)(y) = y (1-y) M^(n)(y) }[/math]
- can be written in the form
- [math]\displaystyle{ G^(n)(y) = poly_1(y) + poly_2(y) * logit(y) }[/math]
- This is the same form as the MetaLog quantile function. When using
"derivative coefficients", the coefficients of the two polynomials are returned as a single vector using the same ordering used by the «a» vector coefficients for the quantile function. In general, you may need a «resultIndex» longer than «K» to capture all the terms, sometimes up to5*IndexLength(K)in length to be safe. Example:KeelinPropertyFromA( a, K, "derivative coefficients", n, resultIndex:Longer_K_idx )
- Let M(y) denote the quantile function, and [math]\displaystyle{ M^(n)(y) }[/math] be the nth derivative. The function
"derivative coefficients2": Returns the coefficients of the nth derivative, but returns the coefficients of [math]\displaystyle{ poly_1(y) }[/math] and [math]\displaystyle{ poly_2(y) }[/math] separately as two return values.KeelinPropertyFromA( a, K, "derivative coefficients2", n, resultIndex:Longer_K_idx )
Misc
"is feasible": Returns True if «a» corresponds to a feasible (valid) quantile function, False if infeasible."mu"or"μ":- When no arg is provided, returns a vector with the subset of «a» coefficients corresponding to the polynomial basis terms. The result is indexed by «resultIndex» if specified, or by «K» if not specified, and is null-padded. To specify the result index, use:
KeelinPropertyFromA(a, K, "mu", resultIndex:J )
- When an arg is provided, it is treated as the y value and it returns [math]\displaystyle{ \mu(y) }[/math] where
- [math]\displaystyle{ M(y) = \mu(y) + s(y) logit(y) }[/math]
- Example:
KeelinPropertyFromA(a, K, "mu", y)
- When no arg is provided, returns a vector with the subset of «a» coefficients corresponding to the polynomial basis terms. The result is indexed by «resultIndex» if specified, or by «K» if not specified, and is null-padded. To specify the result index, use:
"s":- When no arg is provided, returns a vector with the subset of «a» coefficients corresponding to the logit basis terms. The result is indexed by «resultIndex» if specified, or by «K» if not specified, and is null-padded.
- When an arg is provided, returns [math]\displaystyle{ s(y) }[/math].
Enable comment auto-refresher