Failure in reproducing plots in a post

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 quite understand what’s going on in the code. Here’re some rows of my data: *I attach the whole dataset at the end

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

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 do wrong?

I don’t know how to upload the file, but I put my file in R and here’s the code: Jul 10 10:25 AM - Codeshare

I uploaded the csv file:
http://www.sharecsv.com/s/3676944d24cb54ae4adcd8d34e0f2435/newdata.csv

Thank you :slight_smile:

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 so

 testData = d[[2 ;;, {2, 5, 8}]]

Crossposted here.

Thanks! I removed all the NA rows. but when I run the testData = data[[2 ;;, {2, 5, 8}]] , I got this error – Part::take: Cannot take positions 2 through -1 in d.

This works fine

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

It works! Do you wanna post this as an answer in StackExchange? So that I can give you an upvote :slight_smile: