stats::FCorr
-- Fechner
correlationstats::FCorr
(data)
returns the Fechner
correlation coefficient of data pairs.
stats::FCorr([x1, x2, ..], [y1, y2, ..])
stats::FCorr([[x1, y1], [x2, y2], ..])
stats::FCorr(s <, cx, cy>)
stats::FCorr(s <, [cx, cy]>)
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,
.. . |
an arithmetical expression. FAIL
is returned, if the
data are empty.
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.
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.
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
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
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
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