Fit x by y on subset of data vs other subset of dataHi, this is not a JSL question like most of my others are.
I have some data, and I'd like to fit x by y on it, one half of the data vs the other half of the data. I realize a caveman way of doing this is cut pasting the second half of the data into a new column. But I'd really rather not adjust the table like that. Any solutions? I was advised to use the Split function under Tables so I could toy around with that, but is that all there is to it? Anything more specific?
Thank you hugely in advance, and thank you so much for all the help you've been providing to this date. You are an amazing and amazingly patient community.
Best,
Mike
AnalyticsData TableRe: Fit x by y on subset of data vs other subset of dataIf I'm reading your question correctly, it sounds like you have a single column of data that has both your X values and Y values in it.
Do you have a column that identifies whether a row is an X or Y value? Do you have another column (or combination of columns) that identifies which XY pair that row belongs to?
For example, in the table below Value has both X and Y values. Measure identifies whether a row is a height or weight value, and name, age, sex together identify a unique entity for that height or weight.
If this is the kind of data you have then yes, Tables->Split is exactly what you need.
You would complete the Split dialog with Measure in the Split By role, Value in the Split Columns role, and name, age, sex in the Group role.

name
|
age
|
sex
|
Measure
|
Value
|
KATIE
|
12
|
F
|
height
|
59
|
KATIE
|
12
|
F
|
weight
|
95
|
LOUISE
|
12
|
F
|
height
|
61
|
LOUISE
|
12
|
F
|
weight
|
123
|
JANE
|
12
|
F
|
height
|
55
|
JANE
|
12
|
F
|
weight
|
74
|
JACLYN
|
12
|
F
|
height
|
66
|
JACLYN
|
12
|
F
|
weight
|
145
|
LILLIE
|
12
|
F
|
height
|
52
|
LILLIE
|
12
|
F
|
weight
|
64
|
TIM
|
12
|
M
|
height
|
60
|
TIM
|
12
|
M
|
weight
|
84
|
JAMES
|
12
|
M
|
height
|
61
|
JAMES
|
12
|
M
|
weight
|
128
|
ROBERT
|
12
|
M
|
height
|
51
|
ROBERT
|
12
|
M
|
weight
|
79
|
BARBARA
|
13
|
F
|
height
|
60
|
BARBARA
|
13
|
F
|
weight
|
112
|
ALICE
|
13
|
F
|
height
|
61
|
ALICE
|
13
|
F
|
weight
|
107
|
SUSAN
|
13
|
F
|
height
|
56
|
SUSAN
|
13
|
F
|
weight
|
67
|
JOHN
|
13
|
M
|
height
|
65
|
JOHN
|
13
|
M
|
weight
|
98
|
JOE
|
13
|
M
|
height
|
63
|
JOE
|
13
|
M
|
weight
|
105
|
Re: Fit x by y on subset of data vs other subset of dataHi @mostarr,
Ya, split is basically it. @Jeff_Perkinson as given a way to do it if you know what to split by. If there is only a single column in your data, then like copy and paste will be the quickest.
Re: Fit x by y on subset of data vs other subset of dataAnother option besides splitting your datatable is creating a new column to randomly group your rows (or could systematically group them by row counts) into different groupings and use that grouping as an overlay such as in this example:
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Big Class.jmp" );
// New column: Group
Data Table( "Big Class" ) << New Column( "Group",
Character,
"Nominal",
Formula( If( Random Integer( 2 ) == 1, "Group A", "Group B" ) )
);
// Report snapshot: Big Class - Graph Builder
Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ), Overlay( :Group ) ),
Elements(
Points( X, Y, Legend( 5 ) ),
Line Of Fit( X, Y, Legend( 7 ), Equation( 1 ) )
)
);
Re: Fit x by y on subset of data vs other subset of dataThanks for the responses.
I found that a specific type of Split worked perfectly. Now I am wondering if there is a way to save the script automatically? Or do I have to rewrite it manually in JSL?
Mike