1

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?

GarlicSTAT
  • 123
  • 3

1 Answers1

0

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"] &];
Rohit Namjoshi
  • 10,212
  • 6
  • 16
  • 67