Shapes in 2D Statistics

Ivan Cnop
Vrije universiteit Brussel
icnop@vub.ac.be

Initialisation

Off[Solve::ifun]

<< Graphics`ArgColors`

<< Graphics`ComplexMap`

coords[z_] := {Re[z], Im[z]}

Define  Spirograph

Arbitrary data sets

We no longer require the set of points to be similar to the boundary of a starlike domain.
Here is some arbitrary graphical input:

Plot[0, {x, -2, 2}, PlotRange -> {-2, 2}, 
      AspectRatio -> Automatic, GridLines -> Automatic]

pts = {{-0.930951, 0.175965}, {-0.65848, 
            0.297063}, {-0.613068, 0.357612}, {-0.174086, 
            0.327338}, {-1.03691, -0.217605}, {-0.582793, 
            0.0397289}, {-0.446558, 0.236514}, {-0.174086, 
            0.508985}, {-0.113537, 0.569535}, {0.219483, 
            0.796594}, {0.431406, 0.842006}, {0.719014, 0.796594}, {0.189209, 
            0.508985}, {0.507092, 0.781457}, {0.597916, 1.22044}, {1.11258, 
            0.53926}, {0.900662, 0.357612}, {0.280033, 0.524122}, {0.446543, 
            0.357612}, {0.552504, 
            0.115416}, {0.446543, -0.293292}, {0.628191, -0.323566}, {0.401131, -0.00568295}, {0.280033, -0.232742}, {0.143797, -0.323566}, {0.128659, -0.384115}, {-0.0378506, -0.717136}, {-0.325459, -0.520351}, {-0.310322, -0.384115}, {-0.673617, -0.5809}, {-0.749304, -0.656587}, {-0.88554, -0.686861}, {-0.915814, -0.626312}, {-0.49197, -0.141919}, {-0.204361, -0.308429}, {-0.355734, -0.263017}, {-0.416283, -0.24788}, {-0.537382, -0.293292}, {-0.597931, -0.293292}, {-0.734167, -0.263017}, {-1.06719, -0.323566}, {-1.09746, -0.41439}, {-1.1126, -0.474939}, {-1.12774, -0.565763}, {-1.14287, -0.626312}, {-1.18829, -0.747411}, {-1.38507, -1.2318}, {-1.29425, -1.24694}, {-0.174086, -1.00474}, {-0.128675, -0.898784}, {0.340582, -0.64145}, {0.401131, -0.611175}, {0.507092, -0.535488}, {0.582779, -0.474939}, {0.658465, -0.429527}, {0.719014, -0.399253}, {1.26396, 0.251651}, {1.32451, 
            0.493848}, {1.33964, 0.569535}, {1.41533, 0.93283}, {1.41533, 
            0.993379}, {1.35478, 1.05393}, {0.491955, 
            1.17503}, {-0.280048, 0.963104}, {-0.507107, 
            1.00852}, {-0.88554, 0.826869}, {-1.26397, 
            0.720907}, {-1.29425, -0.126781}, {-0.794716, -0.959333}, {0.749289, -0.959333}, {0.885525, -0.717136}, {1.30937, -0.490077}, {1.33964, -0.429527}, {1.38506, -0.368978}, {1.41533, -0.232742}, {1.41533, -0.172193}, {1.41533, -0.0662322}, {1.26396, 1.05393}, {1.24882, 1.11448}, {1.21855, 
            1.19016}, {1.20341, 1.28099}, {1.20341, 1.34154}, {0.522229, 
            1.52318}};

Length[pts]

ListPlot[pts, PlotRange -> {{-2, 2}, {-2, 2}}, 
      AspectRatio -> Automatic]

d[{a_, b_}] := Sqrt[(a^2) + (b^2)]

angle[{a_, b_}] := 
      If[a ≥ 0, t /. First[NSolve[Tan[t] == b/a, {t}]], 
        If[b ≥ 0, π - t /. 
            First[NSolve[Tan[t] == -b/a, {t}]], -π + t /. 
            First[NSolve[Tan[t] == b/a, {t}]]]]

Map[d, pts];

angles = Flatten[Map[angle, pts]];

Remark: for data points with  a and b equal 0 , we do not obtain an angle. This rarely happens in the case of graphical inputs.

comp = 
        Map[d, pts] (E^(I angles));

Show[
      Graphics[Transpose[{Map[ArgColor, comp], 
            Map[Point, Map[coords, comp]]}], 
        PlotRange -> {{-2, 2}, {-2, 2}}, 
        AspectRatio -> Automatic]]

Coloring values according to directions (optional)

Take[
        Table[StyleBox[ToBoxes[d[pts[[i]]]], 
            Background -> Map[ArgColor, comp][[i]]], {i, 
            Length[pts]}], Floor[Length[pts]/2]] // DisplayForm

Correcting the mean

For statistical purposes it is often convenient to have a drawing that is balanced with respect to the origin.
One can hope approximation is better if the initial data do not protrude more in some directions.

Length[pts]

mean[pts_] := Plus @@ pts/Length[pts]

mean[pts]

pts - Table[mean[pts], {Length[pts]}];

Take these as new points

pts = %;

High order shape

d[{a_, b_}] := Sqrt[(a^2) + (b^2)]

angle[{a_, b_}] := 
      If[a ≥ 0, t /. First[NSolve[Tan[t] == b/a, {t}]], 
        If[b ≥ 0, π - t /. 
            First[NSolve[Tan[t] == -b/a, {t}]], -π + t /. 
            First[NSolve[Tan[t] == b/a, {t}]]]]

Map[d, pts];

angles = Flatten[Map[angle, pts]];

comp = 
        Map[d, pts] (E^(I angles));

Show[
      Graphics[Transpose[{Map[ArgColor, comp], 
            Map[Point, Map[coords, comp]]}], 
        PlotRange -> {{-2, 2}, {-2, 2}}, 
        AspectRatio -> Automatic]]

Polynomial approximation

standard = Flatten[{Cos[Range[0, 6] x], Sin[Range[6] x]}]

f[x_] = 
      Fit[Transpose[{Flatten[Map[angle, pts]], Map[d, pts]}], standard, 
        x]

ListPlot[Transpose[{Flatten[Map[angle, pts]], Map[d, pts]}], 
      PlotRange -> {0, 2}]

Remark: modify PlotRange to see more detail

Show[{%, Plot[f[x], {x, -π, π}]}, 
      PlotRange -> {0.8, 1.5}]

Conversion to the plane

\(A\ usual\ fit\ will\ not\ work\ since\ {f . 
              cos \((θ)\), \ 
          f . sin \((θ)\)}\ is\ not\ a\ polynomial\ in\ e\^\(i \((θ)\)\) . 
Since\ the\ function\ under\ review\ is\ periodic\), it is never possible to approximate these by polynomials .  
We first make a trigonometric approximation and then turn this in a comple shifted polynomial . 
The effect of reversing polar coordinates is simply multiplication by  z  .

Making complex this real distance function

f[x] /. {Cos[x] ->  .5 (z + 1/z), 
        Sin[ x] ->  .5/I (z - 1/z), 
        Cos[n_ x] ->  .5 ((z^n) + (z^(-n))), 
        Sin[n_ x] ->  .5/I ((z^n) - 
                (z^(-n)))}

Expand[z %]

CoefficientList[% (z^7), z] // TableForm

Apply Spirograph

spirograph[%% /. z -> (E^(I t)), 
      t]

Show[%, PlotRange -> {{-2, 2}, {-2, 2}}, 
      AspectRatio -> Automatic]

Animate this result over a copy of the initial data:

Low order shape

The following gives an approximation up to order 4 of the data set. The result is a shifted polynomial of order 4, with five coefficients.

Polynomial approximation

standard = Flatten[{Cos[Range[0, 2] x], Sin[Range[2] x]}]

f[x_] = 
      Fit[Transpose[{Flatten[Map[angle, pts]], Map[d, pts]}], standard, 
        x]

ListPlot[Transpose[{Flatten[Map[angle, pts]], Map[d, pts]}], 
      PlotRange -> {0, 2}]

Remark: modify PlotRange to see more detail

Show[{%, Plot[f[x], {x, -π, π}]}, 
      PlotRange -> {0.8, 1.5}]

Conversion to the plane

\(A\ usual\ fit\ will\ not\ work\ since\ {f . 
              cos \((θ)\), \ 
          f . sin \((θ)\)}\ is\ not\ a\ polynomial\ in\ e\^\(i \((θ)\)\) . 
Since\ the\ function\ under\ review\ is\ periodic\), it is never possible to approximate these by polynomials .  
We first make a trigonometric approximation and then turn this in a comple shifted polynomial . 
The effect of reversing polar coordinates is simply multiplication by  z  .

Making complex this real distance function

f[x] /. {Cos[x] ->  .5 (z + 1/z), 
        Sin[ x] ->  .5/I (z - 1/z), 
        Cos[n_ x] ->  .5 ((z^n) + (z^(-n))), 
        Sin[n_ x] ->  .5/I ((z^n) - 
                (z^(-n)))}

Expand[z %]

CoefficientList[% (z^7), z] // TableForm

Apply Spirograph

spirograph[%% /. z -> (E^(I t)), 
      t]

Show[%, PlotRange -> {{-2, 2}, {-2, 2}}, 
      AspectRatio -> Automatic]

Animate this result over a copy of the initial data:

New insight in data sets

The shape gives more information about the data set than classical methods such as linear regression, correlation , ...
We can think about a new meaning for tendencies, outliers, and so on.

A case of negative correlation

Here is some graphical input that clutters around the second diagonal:

Plot[0, {x, -2, 2}, PlotRange -> {-2, 2}, 
      AspectRatio -> Automatic, GridLines -> Automatic]

pts = {{-1.32452, 1.12961}, {-1.27911, 
            1.06907}, {-1.2337, 1.00852}, {-1.21856, 
            0.947967}, {-1.17315, 0.87228}, {-1.12774, 
            0.796594}, {-1.09746, 0.736045}, {-1.03691, 
            0.675496}, {-0.991501, 0.584672}, {-0.961226, 
            0.508985}, {-0.900677, 0.433299}, {-0.855265, 
            0.357612}, {-0.794716, 0.266788}, {-0.749304, 
            0.191102}, {-0.673617, 0.100278}, {-0.613068, 
            0.0245917}, {-0.537382, -0.0662322}, {-0.476832, -0.126781}, {-0.416283, -0.18733}, {-0.355734, -0.24788}, {-0.249773, -0.338704}, {-0.143812, -0.41439}, {-0.0681252, -0.474939}, {-0.00757599, -0.520351}, {0.0681105, -0.565763}, {0.128659, -0.596038}, {0.219483, -0.671724}, {0.29517, -0.747411}, {0.355719, -0.777685}, {0.431406, -0.838234}, {0.507092, -0.883646}, {0.582779, -0.929058}, {0.68874, -0.989607}, {0.719014, -0.913921}, {0.68874, -0.823097}, {0.673602, -0.747411}, {0.628191, -0.656587}, {0.613053, -0.596038}, {0.567641, -0.520351}, {0.522229, -0.429527}, {0.46168, -0.353841}, {0.401131, -0.293292}, {0.310307, -0.217605}, {0.264895, -0.157056}, {0.158934, -0.0662322}, {0.0832477, 0.00945449}, {0.0226984, 0.0397289}, {-0.0832627, 
            0.100278}, {-0.143812, 0.160827}, {-0.204361, 
            0.191102}, {-0.26491, 0.281926}, {-0.295185, 
            0.342475}, {-0.370871, 0.433299}, {-0.401146, 
            0.493848}, {-0.461695, 0.569535}, {-0.49197, 
            0.630084}, {-0.537382, 0.70577}, {-0.597931, 
            0.796594}, {-0.643343, 0.87228}, {-0.703892, 
            0.963104}, {-0.779578, 1.05393}, {-0.840128, 
            1.14475}, {-0.900677, 1.23558}, {-0.930951, 
            1.3264}, {-0.961226, 1.40209}, {-0.915814, 
            1.3264}, {-0.840128, 1.25071}, {-0.779578, 
            1.19016}, {-0.719029, 1.12961}, {-0.613068, 
            1.00852}, {-0.49197, 0.902555}, {-0.386009, 
            0.811731}, {-0.249773, 0.660358}, {-0.128675, 
            0.53926}, {0.00756121, 0.403024}, {0.158934, 0.281926}, {0.29517, 
            0.14569}, {0.416268, 
            0.00945449}, {0.491955, -0.0813694}, {0.582779, -0.157056}, {0.658465, -0.24788}, {0.719014, -0.323566}, {0.749289, -0.384115}, {0.764426, -0.444665}, {0.794701, -0.520351}, {0.809838, -0.596038}, {0.809838, -0.656587}, {0.840113, -0.732273}, {0.779563, -0.701999}, {0.68874, -0.64145}, {0.613053, -0.5809}, {0.507092, -0.490077}, {0.431406, -0.41439}, {0.340582, -0.323566}, {0.234621, -0.217605}, {0.113522, -0.0965067}, {-0.00757599, 0.100278}, {-0.143812, 
            0.251651}, {-0.26491, 0.387887}, {-0.386009, 
            0.53926}, {-0.49197, 0.660358}, {-0.582793, 
            0.781457}, {-0.65848, 0.887418}, {-0.719029, 
            0.993379}, {-0.809853, 1.0842}, {-0.870402, 
            1.15989}, {-0.946089, 1.23558}, {-0.946089, 
            1.15989}, {-0.946089, 1.09934}, {-0.900677, 
            0.963104}, {-0.870402, 0.811731}, {-0.82499, 
            0.630084}, {-0.734167, 0.403024}, {-0.597931, 
            0.206239}, {-0.537382, 
            0.130553}, {-0.401146, -0.0813694}, {-0.26491, -0.263017}, {-0.128675, -0.429527}, {0.0378358, -0.5809}, {0.158934, -0.701999}, {0.29517, -0.853372}, {0.431406, -0.959333}, {0.552504, -1.05016}, {0.643328, -1.09557}, {0.719014, -1.14098}, {0.779563, -1.18639}, {0.85525, -1.21667}, {0.961211, -1.27722}, {0.85525, -1.17125}, {0.749289, -1.03502}, {0.628191, -0.868509}, {0.522229, -0.732273}, {0.416268, -0.5809}, {0.325444, -0.429527}, {0.219483, -0.278154}, {0.0983851, -0.0813694}, {-0.0227134, 0.130553}, {-0.113537, 
            0.281926}, {-0.189224, 0.433299}, {-0.204361, 
            0.508985}, {-0.234636, 0.599809}, {-0.280048, 
            0.660358}, {-0.340597, 0.675496}, {-0.43142, 
            0.690633}, {-0.522244, 0.70577}, {-0.582793, 
            0.70577}, {-0.643343, 0.720907}, {-0.703892, 
            0.720907}, {-0.688755, 0.614946}, {-0.628205, 
            0.554397}, {-0.552519, 0.463573}, {-0.461695, 
            0.357612}, {-0.340597, 0.221377}, {-0.249773, 
            0.0851409}, {-0.128675, -0.0510948}, {0.0226984, -0.172193}, {0.128659, -0.293292}, {0.264895, -0.384115}, {0.340582, -0.444665}, {0.446543, -0.535488}, {0.552504, -0.611175}, {0.613053, -0.656587}, {0.673602, -0.701999}, {0.703877, -0.762548}, {0.764426, -0.777685}, {0.794701, -0.701999}, {0.809838, -0.64145}, {0.764426, -0.565763}, {0.719014, -0.505214}, {0.658465, -0.444665}, {0.613053, -0.384115}, {0.552504, -0.323566}, {0.491955, -0.263017}, {0.416268, -0.202468}, {0.355719, -0.157056}, {0.29517, -0.111644}, {0.234621, -0.0813694}, {0.174072, -0.0208201}, {0.113522, 0.0245917}, {0.052973, 0.115416}, {-0.0227134, 
            0.191102}, {-0.0529881, 0.266788}, {-0.0983999, 
            0.342475}, {-0.128675, 0.433299}, {-0.174086, 
            0.524122}, {-0.219498, 0.614946}, {-0.249773, 
            0.70577}, {-0.325459, 0.796594}, {-0.340597, 
            0.857143}, {-0.386009, 0.917692}, {-0.446558, 
            0.963104}, {-0.507107, 0.978242}, {-0.567656, 
            0.978242}, {-0.628205, 0.978242}, {-0.688755, 
            0.978242}, {-0.749304, 0.993379}, {-0.855265, 
            1.00852}, {-0.915814, 1.03879}, {-0.976363, 
            1.03879}, {-1.03691, 1.03879}, {-1.1126, 
            0.993379}, {-1.14287, 0.93283}, {-1.14287, 
            0.87228}, {-1.06719, 0.796594}, {-1.00664, 
            0.751182}, {-0.930951, 0.70577}, {-0.855265, 
            0.630084}, {-0.734167, 0.53926}, {-0.65848, 
            0.478711}, {-0.597931, 0.418161}, {-0.507107, 
            0.342475}, {-0.461695, 0.281926}, {-0.401146, 
            0.206239}, {-0.340597, 
            0.100278}, {-0.325459, -0.0208201}, {-0.310322, -0.0965067}, {-0.310322, -0.172193}, {-0.295185, -0.263017}, {-0.280048, -0.338704}, {-0.280048, -0.459802}, {-0.26491, -0.550626}, {-0.249773, -0.64145}, {-0.234636, -0.717136}, {-0.219498, -0.777685}, {-0.189224, -0.838234}, {-0.128675, -0.883646}, {-0.0378506, -0.898784}, {0.0226984, -0.898784}, {0.0983851, -0.913921}, {0.158934, -0.913921}, {0.249758, -0.913921}, {0.310307, -0.929058}, {0.370857, -0.944196}, {0.431406, -0.97447}, {0.491955, -0.989607}, {0.567641, -0.989607}, {0.628191, -1.00474}, {0.68874, -1.00474}, {0.749289, -1.00474}, {0.809838, -1.03502}, {0.85525, -0.959333}, {0.85525, -0.898784}, {0.870387, -0.838234}, {0.870387, -0.717136}, {0.870387, -0.611175}, {0.85525, -0.550626}, {0.809838, -0.474939}, {0.734152, -0.399253}, {0.643328, -0.293292}, {0.552504, -0.217605}, {0.476818, -0.126781}, {0.385994, -0.0510948}, {0.310307, 
            0.0245917}, {0.234621, 0.115416}, {0.174072, 
            0.191102}, {0.113522, 0.281926}, {0.052973, 
            0.387887}, {0.0226984, 0.478711}, {0.00756121, 
            0.53926}, {-0.0227134, 0.599809}, {-0.0378506, 
            0.675496}, {-0.0832627, 0.751182}, {-0.128675, 
            0.811731}, {-0.204361, 0.857143}, {-0.26491, 
            0.87228}, {-0.325459, 0.902555}, {-0.386009, 
            0.93283}, {-0.446558, 0.947967}, {-0.522244, 
            0.963104}, {-0.582793, 0.978242}, {-0.643343, 
            0.978242}, {-0.719029, 0.993379}, {-0.82499, 
            0.993379}, {-0.88554, 1.00852}, {-0.946089, 
            1.03879}, {-1.02178, 1.09934}, {-1.09746, 
            1.14475}, {-1.15801, 1.14475}, {-1.18829, 
            1.0842}, {-1.18829, 1.00852}, {-1.12774, 
            0.887418}, {-1.05205, 0.796594}, {-0.930951, 
            0.645221}, {-0.82499, 0.508985}, {-0.703892, 
            0.357612}, {-0.537382, 0.206239}, {-0.43142, 
            0.0700035}, {-0.325459, -0.0662322}, {-0.219498, -0.202468}, {-0.0832627, -0.368978}, {0.0226984, -0.505214}, {0.128659, -0.611175}, {0.234621, -0.732273}, {0.29517, -0.80796}, {0.355719, -0.913921}, {0.385994, -0.989607}, {0.401131, -1.05016}, {0.401131, -1.11071}, {0.431406, -1.18639}, {0.491955, -1.21667}, {0.507092, -1.27722}, {0.567641, -1.30749}, {0.658465, -1.33777}, {0.719014, -1.3529}, {0.779563, -1.36804}, {0.885525, -1.38318}, {0.976348, -1.41345}, {1.05203, -1.44373}, {1.12772, -1.48914}, {1.18827, -1.50428}, {1.26396, -1.54969}, {1.33964, -1.5951}, {1.40019, -1.64051}, {1.4456, -1.57996}, {1.4456, -1.44373}, {1.40019, -1.38318}, {1.35478, -1.30749}, {1.29423, -1.21667}, {1.24882, -1.14098}, {1.158, -1.05016}, {1.09745, -0.989607}, {1.0369, -0.929058}, {0.961211, -0.853372}, {0.885525, -0.777685}, {0.824975, -0.717136}, {0.764426, -0.686861}, {0.703877, -0.626312}, {0.643328, -0.565763}, {0.597916, -0.505214}, {0.537367, -0.444665}, {0.507092, -0.384115}, {0.476818, -0.323566}, {0.446543, -0.24788}, {0.416268, -0.18733}, {0.401131, -0.111644}, {0.340582, -0.0662322}, {0.29517, -0.00568295}, {0.264895, 
            0.0548663}, {0.204346, 0.14569}, {0.143797, 
            0.221377}, {0.0832477, 0.327338}, {0.0226984, 
            0.403024}, {-0.0378506, 0.403024}, {-0.113537, 
            0.448436}, {-0.174086, 0.493848}, {-0.26491, 
            0.524122}, {-0.325459, 0.554397}, {-0.386009, 
            0.569535}, {-0.461695, 0.614946}, {-0.522244, 
            0.660358}, {-0.597931, 0.690633}, {-0.673617, 
            0.751182}, {-0.749304, 0.766319}, {-0.809853, 
            0.781457}};

Length[pts]

ListPlot[pts, PlotRange -> {{-2, 2}, {-2, 2}}, 
      AspectRatio -> Automatic]

The aim of this text is to show that for these data we obtain an approximating spirograph curve that is  very different from the one we have in cases of random distributions or positive correlations.

d[{a_, b_}] := Sqrt[(a^2) + (b^2)]

angle[{a_, b_}] := 
      If[a ≥ 0, t /. First[NSolve[Tan[t] == b/a, {t}]], 
        If[b ≥ 0, π - t /. 
            First[NSolve[Tan[t] == -b/a, {t}]], -π + t /. 
            First[NSolve[Tan[t] == b/a, {t}]]]]

Map[d, pts];

angles = Flatten[Map[angle, pts]];

Remark: for data points with  a and b equal 0 , we do not obtain an angle. This rarely happens in the case of graphical inputs.

comp = 
        Map[d, pts] (E^(I angles));

Show[
      Graphics[Transpose[{Map[ArgColor, comp], 
            Map[Point, Map[coords, comp]]}], 
        PlotRange -> {{-2, 2}, {-2, 2}}, 
        AspectRatio -> Automatic]]

Correcting the mean

Length[pts]

mean[pts_] := Plus @@ pts/Length[pts]

mean[pts]

pts - Table[mean[pts], {Length[pts]}];

Take these as new points

pts = %;

d[{a_, b_}] := Sqrt[(a^2) + (b^2)]

angle[{a_, b_}] := 
      If[a ≥ 0, t /. First[NSolve[Tan[t] == b/a, {t}]], 
        If[b ≥ 0, π - t /. 
            First[NSolve[Tan[t] == -b/a, {t}]], -π + t /. 
            First[NSolve[Tan[t] == b/a, {t}]]]]

Map[d, pts];

angles = Flatten[Map[angle, pts]];

comp = 
        Map[d, pts] (E^(I angles));

Show[
      Graphics[Transpose[{Map[ArgColor, comp], 
            Map[Point, Map[coords, comp]]}], 
        PlotRange -> {{-2, 2}, {-2, 2}}, 
        AspectRatio -> Automatic]]

Polynomial approximation

standard = Flatten[{Cos[Range[0, 6] x], Sin[Range[6] x]}]

f[x_] = 
      Fit[Transpose[{Flatten[Map[angle, pts]], Map[d, pts]}], standard, 
        x]

ListPlot[Transpose[{Flatten[Map[angle, pts]], Map[d, pts]}], 
      PlotRange -> {0, 2}]

Making complex this real distance function

f[x] /. {Cos[x] ->  .5 (z + 1/z), 
        Sin[ x] ->  .5/I (z - 1/z), 
        Cos[n_ x] ->  .5 ((z^n) + (z^(-n))), 
        Sin[n_ x] ->  .5/I ((z^n) - 
                (z^(-n)))}

Expand[z %]

CoefficientList[% (z^7), z] // TableForm

Apply Spirograph

spirograph[%% /. z -> (E^(I t)), 
      t]

Show[%, PlotRange -> {{-2, 2}, {-2, 2}}, 
      AspectRatio -> Automatic, Axes -> True]

Animate this result over a copy of the initial data:

ListPlot[pts, PlotRange -> {{-2, 2}, {-2, 2}}, 
      AspectRatio -> Automatic]

Outliers are readily identified: they are far outside the approximating curve, or show them simultaneaously:

Show[{%, %%}]

The curve gives a lot more information about the data set than the correlation.

Assignment

Repeat this with a real 2D data set of observed measurements.