If one wishes to analytically generate a height series with the given statistical moments Sk and Ku, a means is to transform a Gaussian series with Johnson’s Translation System. But an alternative means is to use the tangent function:
The i surface height is expressed as:
with and . As explained above the limits are and
The use of an analytical representation of the heights is of limited interest if the sums, as expressed above, cannot be avoided because it becomes time consuming for large .
So, how will be the statistical moments calculated in a discrete problem?
… recalling that Simpson’s method involves such sums and that it links it to the function integral.
NB : it is considered that is an even number, so
It can be deduced from the figure:
As for the borders:
As a result:
therefore:
A formula that links the mean of a sum to a function integral has been determined. The same goes for the standard deviation which is the mean of the sum of squares. The same process applies therefore to the four statistical moments, provided that one is able to analytically determine the integrals (Maxima and Mathematica are useful tools).
Function that adds to the series mean the border integrals as explained in the modules presentation.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=I4), | intent(in) | :: | n |
statistical moment degree, n=3 for sk and n=4 for ku |
||
integer(kind=I4), | intent(in) | :: | deb |
first integration point |
||
integer(kind=I4), | intent(in) | :: | fin |
last integration point |
||
real(kind=R8), | intent(in) | :: | alp |
offset so that points are in [b1,b2] |
||
real(kind=R8), | intent(in) | :: | bet |
reduction so that points are in [b1,b2] |
||
real(kind=R8), | intent(in) | :: | mu |
numerical mean |
||
real(kind=R8), | intent(in) | :: | si |
numerical standard deviation |
Function that adds to the series mean the border integrals as explained in the docs
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=I4), | intent(in) | :: | n |
statistical moment degree, n=3 for sk and n=4 for ku |
||
integer(kind=I4), | intent(in) | :: | deb |
first integration point |
||
integer(kind=I4), | intent(in) | :: | fin |
last integration point |
||
real(kind=R8), | intent(in) | :: | alp |
offset so that points are in [b1,b2] |
||
real(kind=R8), | intent(in) | :: | bet |
reduction so that points are in [b1,b2] |
||
real(kind=R8), | intent(in) | :: | mu |
numerical mean |
||
real(kind=R8), | intent(in) | :: | si |
numerical standard deviation |
Profile function based on the exponential function
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=R8), | intent(in) | :: | xi |
abscissa |
||
integer(kind=I4), | intent(in) | :: | n |
statistical moment degree, n=3 for sk and n=4 for ku |
||
real(kind=R8), | intent(in) | :: | alp |
offset so that points are in [b1,b2] |
||
real(kind=R8), | intent(in) | :: | bet |
reduction so that points are in [b1,b2] |
||
real(kind=R8), | intent(in) | :: | mu |
numerical mean |
||
real(kind=R8), | intent(in) | :: | si |
numerical standard deviation |
Generic cost function: difference between the imposed statistical moments and those obtained. The optimization problem must be turned into a maximization problem (as often in the optimization routines).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=I4), | intent(in) | :: | n |
number of unknowns |
||
real(kind=R8), | intent(in), | dimension(1:n) | :: | x |
vector of unknowns |
Profile function based on the tangent function
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=R8), | intent(in) | :: | xi |
abscissa |
||
integer(kind=I4), | intent(in) | :: | n |
statistical moment degree, n=3 for sk and n=4 for ku |
||
real(kind=R8), | intent(in) | :: | alp |
offset so that points are in [b1,b2] |
||
real(kind=R8), | intent(in) | :: | bet |
reduction so that points are in [b1,b2] |
||
real(kind=R8), | intent(in) | :: | mu |
numerical mean |
||
real(kind=R8), | intent(in) | :: | si |
numerical standard deviation |
Function that returns a set of heights that matches desired statistical moments.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=R8), | intent(out), | dimension(1:lg) | :: | vec_out |
height vector |
|
logical(kind=I4), | intent(in) | :: | use_fct_expo |
should exponential function rather than tangent function be used? |
||
type(moment_stat), | intent(in) | :: | stats_in |
input statistical moments |
||
integer(kind=I4), | intent(in) | :: | lg |
length of the height vector |
Function to calculate the skewness and kurtosis of an exponential series.
The principle is the same as calculs_skku_tan, however it fits better some particular
series quite binary (roughly two heights).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=R8), | intent(in), | dimension(1:2) | :: | bounds |
interval limits [-(1/bounds(1)-1), +(1/bounds(2)-1)] |
|
integer(kind=I4), | intent(in) | :: | lg |
vec size |
||
real(kind=R8), | intent(out) | :: | ssk |
theoretical Ssk |
||
real(kind=R8), | intent(out) | :: | sku |
theoretical Sku |
Function that calls the right series generator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=R8), | intent(in), | dimension(:) | :: | bounds |
interval limits |
|
integer(kind=I4), | intent(in) | :: | lg |
vec size |
||
real(kind=R8), | intent(out) | :: | ssk |
theoretical Ssk |
||
real(kind=R8), | intent(out) | :: | sku |
theoretical Sku |
Function to calculate the skewness and kurtosis of a tangent series
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=R8), | intent(in), | dimension(1:2) | :: | bounds |
defines the function limits [-pi/2.(1-bounds(1)), +pi/2.(1-bounds(2)] |
|
integer(kind=I4), | intent(in) | :: | lg |
vec size |
||
real(kind=R8), | intent(out) | :: | ssk |
theoretical Ssk |
||
real(kind=R8), | intent(out) | :: | sku |
theoretical Sku |
Quantify de distance between desired moments and calculated moments
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(pikaia_class), | intent(inout) | :: | me | |||
real(kind=R8), | intent(in), | dimension(:) | :: | x | ||
real(kind=R8), | intent(out) | :: | f |
This is a refactoring of the PIKAIA unconstrained optimization code from the High Altitude Observatory. The original code is public domain and was written by Paul Charbonneau & Barry Knapp.
Type | Intent | Optional | Attributes | Name | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
type(pikaia_class), | intent(inout) | :: | pik_class |
PIKAIA class instanciation |
||||||||||||||||||||||||||||||
character(len=4), | intent(in) | :: | step |
init or solv |
||||||||||||||||||||||||||||||
real(kind=R8), | intent(in), | dimension(1:nparam) | :: | xl |
lower bonds of xx |
|||||||||||||||||||||||||||||
real(kind=R8), | intent(in), | dimension(1:nparam) | :: | xu |
upper bonds of xx |
|||||||||||||||||||||||||||||
integer(kind=I4), | intent(in) | :: | nparam |
number of parameters |
||||||||||||||||||||||||||||||
private subroutine cost(me, x, f)Arguments
|
||||||||||||||||||||||||||||||||||
integer(kind=I4), | intent(out) | :: | istat | |||||||||||||||||||||||||||||||
real(kind=R8), | intent(out) | :: | f | |||||||||||||||||||||||||||||||
real(kind=R8), | intent(out), | dimension(1:nparam) | :: | xx |
chromosom for PIKAIA |
Function that generates the heights when the function limits have been determined.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=R8), | intent(out), | dimension(1:lg) | :: | tab |
height vector |
|
integer(kind=I4), | intent(in) | :: | lg |
height vector size |
||
real(kind=R8), | intent(in), | dimension( : ) | :: | x |
unknowns: height function limits |
|
type(moment_stat), | intent(out) | :: | mx |
resulting statistical moments |