Choose Language Hide Translation Bar
Highlighted
Knut
Level III

Graph Builder: Connect points AND show regression line

For each animal, I want to connect the three points showing its weight change (see the black points), but I also want to show the regression line. If I "overlay" all animals, I'm losing the option to calculate regression across all "overlays". The concept of "overlaying" different graphs doesn't seem to fit well with a comprehensive analysis of all animals in a study. Neither does the concept of a "parallel plot", when the x-axis is not different scales, but different time points of the same variable.

 

NoLines.JPG

3 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Knut
Level III

Re: Graph Builder: Connect points AND show regression line

Yes, I have JMP 14.

View solution in original post

Highlighted
txnelson
Super User

Re: Graph Builder: Connect points AND show regression line

Then do the graph as you did in your first discussion.  Add Animal as an overlay column.  Click on the graph and select Add.  Choose to add a Line.  On the left side of the window, go to the the properties for the new line.  Expand the "Variables" section, and uncheck Overlay Animal.

Jim

View solution in original post

Highlighted
Knut
Level III

Re: Graph Builder: Connect points AND show regression line

That's it! Thanks a lot!

 

View solution in original post

6 REPLIES 6
Highlighted
txnelson
Super User

Re: Graph Builder: Connect points AND show regression line

You can fix your graph by changing the Week column to a continuous variable, and then overlaying Animals, and then adding a second line, and ploting it through the mean, but removing the Overlay variable from the definition.

2line.PNG

names default to here(1);
dt = New Table( "Example",
	Add Rows( 30 ),
	New Script(
		"Source",
		Data Table( "big class" ) << Concatenate(
			Data Table( "big class" ),
			Data Table( "big class" )
		)
	),
	New Column(
		["en" => "name", "ja" => "名前", "x-id" => "S_name_Col", "zh-CN" => "姓名"],
		Character,
		"Nominal",
		Set Property( "Notes", "...usually used as a label variable in plots" ),
		Set Values(
			{"KATIE", "LOUISE", "JANE", "JACLYN", "LILLIE", "TIM", "JAMES", "ROBERT",
			"BARBARA", "ALICE", "KATIE", "LOUISE", "JANE", "JACLYN", "LILLIE", "TIM",
			"JAMES", "ROBERT", "BARBARA", "ALICE", "KATIE", "LOUISE", "JANE",
			"JACLYN", "LILLIE", "TIM", "JAMES", "ROBERT", "BARBARA", "ALICE"}
		)
	),
	New Column(
		["en" => "age", "ja" => "年齢", "x-id" => "S_age_Col", "zh-CN" => "年龄"],
		Numeric,
		"Continuous",
		Format( "Fixed Dec", 5, 0 ),
		Set Property( "Notes", "Explore data adventurously" ),
		Set Values(
			[10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11,
			11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12]
		)
	),
	New Column(
		["en" => "sex", "ja" => "性別", "x-id" => "S_sex_Col", "zh-CN" => "性别"],
		Character( 2 ),
		"Nominal",
		Set Property( "Notes", "Explore data adventurously" ),
		Set Values(
			{"F", "F", "F", "F", "F", "M", "M", "M", "F", "F", "F", "F", "F", "F",
			"F", "M", "M", "M", "F", "F", "F", "F", "F", "F", "F", "M", "M", "M",
			"F", "F"}
		)
	),
	New Column( "Measurement",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected,
		Set Values(
			[89.959512942005, 94.265830994118, 60.9183478215709, 95.2894369501155,
			100.92544442974, 72.8645000001416, 90.6610060471576, 80.9968326007947,
			110.147639254574, 81.2141562544275, 86.8546054849867, 119.671143941814,
			67.2093557997141, 103.23300153017, 72.5169731513597, 70.9814733604435,
			90.8327138214372, 63.7885711505078, 107.963811784284, 72.4180357693695,
			115.559900880326, 55.6334275682457, 87.0823451085016, 82.9334855871275,
			74.3693295912817, 100.173055256018, 105.379759377101, 77.838793330593,
			115.123678956879, 64.664425291121]
		)
	),
	Set Label Columns( :name )
);
Graph Builder(
	Size( 570, 735 ),
	Variables( X( :age ), Y( :Measurement ), Group Y( :sex ), Overlay( :name ) ),
	Elements(
		Points( X, Y, Legend( 8 ) ),
		Line( X, Y, Legend( 9 ) ),
		Line( X, Y, Overlay( 0 ), Legend( 10 ) )
	),
	SendToReport(
		Dispatch( {"Line"}, "", OutlineBox, {Close( 0 )} ),
		Dispatch(
			{},
			"age",
			ScaleBox,
			{Min( 9 ), Max( 13 ), Inc( 1 ), Minor Ticks( 1 )}
		),
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model(
				8,
				Base( 0, 0, 0, Item ID( "ALICE", 1 ) ),
				Base( 1, 0, 0, Item ID( "BARBARA", 1 ) ),
				Base( 2, 0, 0, Item ID( "JACLYN", 1 ) ),
				Base( 3, 0, 0, Item ID( "JAMES", 1 ) ),
				Base( 4, 0, 0, Item ID( "JANE", 1 ) ),
				Base( 5, 0, 0, Item ID( "KATIE", 1 ) ),
				Base( 6, 0, 0, Item ID( "LILLIE", 1 ) ),
				Base( 7, 0, 0, Item ID( "LOUISE", 1 ) ),
				Base( 8, 0, 0, Item ID( "ROBERT", 1 ) ),
				Base( 9, 0, 0, Item ID( "TIM", 1 ) )
			), Legend Model(
				10,
				Properties(
					0,
					{Line Color( 0 ), Line Width( 3 )},
					Item ID( "Mean", 1 )
				)
			)}
		)
	)
)
Jim
Highlighted
Knut
Level III

Re: Graph Builder: Connect points AND show regression line

Thanks for looking into and helping with this.

Am I correct to understand that one needs to essentially create two plots,

- one plot for the regression model (based on all observational units) and
- one plot to connect the data points belonging to each of the observational units (as an “overlay” plot)

and then overlaying the two plots?

Is there a way to do this within the Graph Builder GUI?
Highlighted
txnelson
Super User

Re: Graph Builder: Connect points AND show regression line

The graph is built all in one chart.......assuming you have JMP 14.  The methodology I used requires JMP 14 functionality

Jim
Highlighted
Knut
Level III

Re: Graph Builder: Connect points AND show regression line

Yes, I have JMP 14.

View solution in original post

Highlighted
txnelson
Super User

Re: Graph Builder: Connect points AND show regression line

Then do the graph as you did in your first discussion.  Add Animal as an overlay column.  Click on the graph and select Add.  Choose to add a Line.  On the left side of the window, go to the the properties for the new line.  Expand the "Variables" section, and uncheck Overlay Animal.

Jim

View solution in original post

Highlighted
Knut
Level III

Re: Graph Builder: Connect points AND show regression line

That's it! Thanks a lot!

 

View solution in original post

Article Labels

    There are no labels assigned to this post.