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$
  • $\begingroup$ @Anton Antonov Do you mind to help with this question? $\endgroup$ – GarlicSTAT Mar 14 at 22:33
  • $\begingroup$ Crossposted here. $\endgroup$ – Rohit Namjoshi Mar 15 at 1:33
  • $\begingroup$ @RohitNamjoshi thank you $\endgroup$ – GarlicSTAT Mar 15 at 1:50
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"] &];
| improve this answer | |
$\endgroup$

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.