3
$\begingroup$

I want to normalize a series of numbers to all be between -1 and 1, but I would like to do it in a way where the relative difference between price elements stays the same, if possible.

Example list of price series price_list = np.array([4.8, 7.2, 5.0, 8.1])

I use this equation to normalize between -1 and 1. (2*(price_list - min(price_list)) / (max(price_list) - min(price_list)))-1 This returns array([-1. , 0.45454545, -0.87878788, 1. ])

Let's take the ratio between the 0th and 1st non-normalized values. 4.8 / 7.2 = 0.6666666666666666 But the ratio of the 0th and 1st elements in the normalized list is -1 / 0.45454545 = -2.200000022

I would like the data normalized between -1 and 1 in a way that the ratio is also 0.6666666666666666.

$\endgroup$

1 Answer 1

7
$\begingroup$

This is not possible.

Consider only 2 numbers, $a$ and $b$. The ratio of one to the other will be $a/b$. But after scaling the larger will become 1, the smaller $-$1, and the ratio will always be $-$1.

Note that ratios change when numbers are added or subtracted. If your extreme values are symmetric around 0, say your largest value is $a$ and your smallest is $-a$, then you can simply divide everything by $a$ to get the desired scaling. But if you have to shift the dataset by addition or subtraction, then ratios will change.

$\endgroup$
1
  • 2
    $\begingroup$ OP: Thinking that price ratios make sense is equivalent to working with price on a logarithmic scale, which I would recommend over the ad hoc normalized ratio approach, which as nicely shown here introduces more problems than it solves. $\endgroup$
    – Nick Cox
    Aug 2, 2021 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.