covariance Interface

public interface covariance

Module Procedures

private pure function covariance_array(x, y) result(rst)

Computes the sample covariance of two data sets.

The covariance computed is the sample covariance such that .

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in), dimension(:) :: x

The first N-element data set.

real(kind=real64), intent(in), dimension(size(x)) :: y

The second N-element data set.

Return Value real(kind=real64)

Sample covariance; fewer than two observations or nonfinite inputs give NaN. An unrepresentable result gives signed infinity.

private pure function covariance_columns(x, y) result(rst)

Computes sample covariance using independent copies of two columns. Unequal counts cause ERROR STOP with FS_ARRAY_SIZE_ERROR.

Arguments

Type IntentOptional Attributes Name
class(data_column), intent(in) :: x

Paired observation columns, unchanged; unallocated storage is empty.

class(data_column), intent(in) :: y

Paired observation columns, unchanged; unallocated storage is empty.

Return Value real(kind=real64)

Sample covariance; fewer than two pairs or nonfinite values give NaN. Unrepresentable results give signed infinity.

private pure function covariance_column_array(x, y) result(rst)

Computes sample covariance between a column and an array, copying the column. Unequal counts cause ERROR STOP with FS_ARRAY_SIZE_ERROR.

Arguments

Type IntentOptional Attributes Name
class(data_column), intent(in) :: x

The first observation column, unchanged; unallocated storage is empty.

real(kind=real64), intent(in), dimension(:) :: y

The paired observations; must have x's count.

Return Value real(kind=real64)

Sample covariance; undersized/nonfinite data give NaN; unrepresentable results give signed infinity.

private pure function covariance_array_column(x, y) result(rst)

Computes sample covariance between an array and a column, copying the column. Unequal counts cause ERROR STOP with FS_ARRAY_SIZE_ERROR.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in), dimension(:) :: x

The first observation array.

class(data_column), intent(in) :: y

The paired observation column, unchanged; must have size(x) values. Unallocated storage is treated as empty.

Return Value real(kind=real64)

Sample covariance; undersized/nonfinite data give NaN; unrepresentable results give signed infinity.