According to the data of the "weight" column in document "Arrhythmia" 、and the "criterion" file in the attachment, the "level" column is obtained.
Then, according to the "level" column and "class" column, the data of "V3 QRSTA" column are classified according to the following rules:
Row basis is "level", column basis is "class", and positive value and negative value of "V3 QRSTA" column are classified and summarized respectively.
The above operations can be easily completed with excel and its functions, but the speed is slow when the data volume is large.
If the amount of data is large, how to use JMP JSL should be completed more quickly.Thank you very much!
This problem is quite complicated. I made several pictures and uploaded 2 files.
Here is an example of one way to do the processing to set the grade for each raw data row. I have it set to have an Example data table of 50,000, which on my 4 year olf Window's pc takes about 2 seconds to create the example data and then to set the grade for each row.
Names Default To Here( 1 );
// Create a sample standards table
dtStandard = New Table( "Standards",
Add Rows( 200 ),
New Column( "standards", formula( Random Integer( 93500, 1000000 ) ) )
);
dtStandard << run formulas;
dtStandard:standards << delete property( "formula" );
dtStandard << sort( by( :standards ), order( ascending ), replace table( 1 ) );
dtStandard << rerun formulas;
dtStandard << New Column( "grades", formula( Row() ) );
dtStandard:grades << delete property( "formula" );
// Create an example table
dt = New Table( "Example",
Add Rows( 50000 ),
New Column( "Raw Data", formula( Random Integer( 93500, 1000000 ) ) )
);
dt << run formulas;
dt:Raw Data << delete property( "formula" );
// Make sure the standards table has the same range as the example table
If( dtStandard:standards[1] > Col Min( dt:raw data ),
dtStandard:standards[1] = Col Min( dt:raw data )
);
If( dtStandard:standards[200] < Col Max( dt:raw data ),
dtStandard:standards[200] = Col Max( dt:raw data )
);
// Set the standard
// The code below is the actual code that performs the setting of the grade
// Create a column to hold the original row positions in the data table
dt << New Column( "OrigRow", formula( Row() ) );
dt:OrigRow << delete property( "formula" );
// Add the new grades column to the Example data
dt << New Column( "grade" );
// Sort the data in order of the raw data
dt << sort( by( :Raw Data ), order( ascending ), replace table( 1 ) );
For( i = 1, i <= N Rows( dt ), i++,
If( i == 1,
lkupRow = Max( dtStandard << get rows where( dtStandard:standards <= dt:Raw Data[i] ) )
);
While( dtStandard:standards[lkupRow] < dt:Raw Data[i], lkupRow = lkupRow + 1 );
dt:grade[i] = dtStandard:grades[lkupRow];
);
// Sort the data back to the original order
dt << sort( by( :OrigRow ), order( ascending ), replace table( 1 ) );
// Delete the origrow column
dt << delete columns( "OrigRow" );
dt = Open( "$SAMPLE_DATA/Arrhythmia.jmp" );
When I did it myself, I added three columns to file Arrhythmia.jmp :"level"、"positive"、"negative".
I know it's stupid, but it's the only way I can handle it.Thank you very much!
It seems that there are many steps in my project, so I need to complete it in several steps:
Solve the first step above all: how to divide "weight" column by the "criterion" in accessory a few grades.
See screenshot for standard: The operation of this step, I can only use the way of "IF". Excel has several functions that do this. How does JSL do this quickly?Thank you very much!
This can be handled easily in a JMP formula
If(weight<=30, 1
weight <= 40, 2,
weight <= 50, 3,
etc.
)
If you had the classification in a table as shown above, a script could easily create the expression for the necessary If() function. Or you could use the approach of lookup in such a table.
More than 100 classes? Would they be meaningful or useful? At this point you might want to just use the original continuous variable.