## `stats::FCorr` -- Fechner correlation

#### Introduction

`stats::FCorr``(data)` returns the Fechner correlation coefficient of data pairs.

#### Call(s)

`stats::FCorr([x1, x2, ..], [y1, y2, ..])`
`stats::FCorr([[x1, y1], [x2, y2], ..])`
`stats::FCorr(s <, cx, cy>)`
`stats::FCorr(s <, [cx, cy]>)`

#### Parameters

`x1, x2, ..` | - | statistical data: arithmetical expressions.
`y1, y2, ..` | - | statistical data: arithmetical expressions.
`s` | - | a sample of domain type `stats::sample`.
`cx, cy` | - | integers representing column indices of the sample `s`. Column `cx` provides the data `x1, x2, ..`, column `cy` provides the data `y1, y2, ..`.

#### Returns

an arithmetical expression. `FAIL` is returned, if the data are empty.

#### Related Functions

`stats::BPCorr`, `stats::sample`

#### Details

- The Fechner correlation coefficient of n data pairs (x[i], y[i]) is given by (2*V - n)/n with V = v[1]+ .. +v[n]. The number v[i] is 1, if x[i]-X and y[i]-Y have the same sign or are both 0. It is 1/2, if either x[i]-X or y[i]-Y is 0. It is 0 in all other cases. Here X and Y are the mean values of the data x[i] and y[i], respectively.

  The Fechner correlation coefficient is a number between -1 and 1. It is positive for a positive linear relation and negative for a negative linear relation.

- The column indices `cx`, `cy` are optional, if the data are given by a sample object containing only two non-string columns. Cf. example 2.

- The Fechner correlation should not be computed for symbolic data. These may lead to unexpected results, if the sign of symbolic parameters cannot be determined.

#### Example 1

We calculate the Fechner correlation coefficient of four data pairs given in two lists. There is a positive linear relation y = 1+2*x between the entries of the lists:

    >> stats::FCorr([0, 1, 2, 3], [1, 3, 5, 7])

                                         1

Alternatively, the data may be specified by a list of pairs:

    >> stats::FCorr([[0, 0], [1, -3], [2, -4], [3, -3]])

                                       -1/2

#### Example 2

We create a sample consisting of one string column and two non-string columns:

    >> stats::sample([["a", 0, 0], ["b", 10, 10], ["c", 20, 35]])

                                   "a"   0   0
                                   "b"  10  10
                                   "c"  20  35

The Fechner correlation coefficient is calculated using the data columns 2 and 3. In this example there are only two non-string columns, so the column indices do not have to be specified:

    >> stats::FCorr(%)

                                        2/3

#### Example 3

We create a sample consisting of three data columns:

    >> stats::sample([[1, 0, 0], [2, 10, 10], [3, 20, 35]])

                                    1   0   0
                                    2  10  10
                                    3  20  35

We compute the Fechner correlation coefficient of the data pairs given by the first and the second column:

    >> stats::FCorr(%, 1, 2)

                                         1

#### Example 4

We create a sample consisting of three columns:

    >> stats::sample([[1, -3, 1], [2, -8, 3], [3, -12, 5], [5, 10, 7]])

                                    1   -3  1
                                    2   -8  3
                                    3  -12  5
                                    5   10  7

We compute the Fechner correlation coefficient of the data pairs given by the second and the third column. Here we specify these columns by a list of column indices:

    >> stats::FCorr(%, [1, 2])

                                         0

#### Changes

- new function

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000