1
$\begingroup$

I am trying to reproduce the plots in this post Finding outliers in 2D and 3D numerical data with my own data.

However, I am new to the wolfram language (I used to use R). I don't quit understanding what's going on in the codes. Here're some rows of my data: enter image description here

I want to create a 3D Quantile Regression envelopes to find the outliers as in the post, with the varible Age, Ratio.bp, and Ratio.heart. However, I can't get any the plots. Here's an example: enter image description here

Here's my code:

testData = N@data[[All, {2, 5, 8}]];
sTestData = Transpose[Standardize /@ Transpose[N@testData]];
Block[{offset = -2 (Min /@ Transpose[sTestData])}, 
  sTestData = Map[# + offset &, sTestData]];
opts = {PlotRange -> All, ImageSize -> Medium, 
   PlotTheme -> "Detailed"};
Grid[{{ListPointPlot3D[sTestData, opts], 
   ListPointPlot3D[sTestData, opts]}}]

What did i did wrong?

$\endgroup$
3
  • $\begingroup$ @Anton Antonov Do you mind to help with this question? $\endgroup$
    – GarlicSTAT
    Mar 14, 2020 at 22:33
  • $\begingroup$ Crossposted here. $\endgroup$ Mar 15, 2020 at 1:33
  • $\begingroup$ @RohitNamjoshi thank you $\endgroup$
    – GarlicSTAT
    Mar 15, 2020 at 1:50

1 Answer 1

0
$\begingroup$

Some problems

The data contains non-numeric values e.g. "NA". You will have to remove those rows or impute the missing values using e.g. SynthesizeMissingValues.

The header row needs to be excluded as well, so do this and the rest of the code will work

data = Import["~/Downloads/new_heart_data.csv"];
testData = data[[2 ;;, {2, 5, 8}]] // Select[FreeQ[#, "NA"] &];
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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