cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
Roman-V
Level I

Fitting model to ordinal factors and response

 

Hello, I have such a diagram and want to figure out the equation which produces it:

Untitled picture.png

 

 

 

 

 

 

One can imagine it as a 3-dimentional space with color responces for every S/U/D combination.

I filled S/U/D into a JMP table to fit (some kind of) model but realized immediately, that the response in color code (e.g. 1 for green, 2 for yelow and 3=red) doesn't make much sense.

To my understanding, the equation behind this diagram generates 4x4x3=48 values and colors correspond to certain parts of values. For example, 30% of upper values get red, 25% lower -- green. The rest is yellow.

How then should I represent the responce?

Isn't it too many unknowns for this task? 

2 REPLIES 2
txnelson
Super User

Re: Fitting model to ordinal factors and response

You may want to try building your model using Partioning.  Below is a scirpt that creates your table and then runs a Partition(Decision Tree) Analysis

names default to here(1);
dt = New Table( "Example",
	Add Rows( 48 ),
	New Column( "d",
		Numeric,
		"Nominal",
		Format( "Best", 12 ),
		Set Values(
			[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2,
			2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]
		)
	),
	New Column( "u",
		Numeric,
		"Nominal",
		Format( "Best", 12 ),
		Set Values(
			[1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
			1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
		)
	),
	New Column( "s",
		Numeric,
		"Nominal",
		Format( "Best", 12 ),
		Set Values(
			[1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 1, 1, 1, 1, 2, 2, 2, 2,
			3, 3, 3, 3, 4, 4, 4, 4, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4]
		)
	),
	New Column( "value",
		Character,
		"Nominal",
		Set Values(
			{"Low", "Low", "Low", "Med", "Low", "Low", "Low", "Med", "Low", "Low",
			"Med", "Med", "Low", "Med", "Med", "Med", "Low", "Low", "Med", "High",
			"Low", "Low", "Med", "High", "Low", "Med", "High", "High", "Med", "High",
			"High", "High", "Med", "Med", "High", "High", "Med", "Med", "High",
			"High", "Med", "High", "High", "High", "High", "High", "High", "High"}
		)
	)
);


dt << Partition(
	Y( :value ),
	X( :d, :u, :s ),
	Informative Missing( 1 ),
	Initial Splits(
		:d == {1},
		{:u == {4, 3}},
		{:u == {1, 2}, {:d == {2}}, {:d == {2}}}
	),
	SendToReport(
		Dispatch( {}, "Partition Report", FrameBox, {Frame Size( 480, 74 )} )
	)
);
Jim

Re: Fitting model to ordinal factors and response

Jim's suggestion to use a recursive partitioning method is great. The fact is, there is more than one way that you can model this ordinal reponse under different conditions of S, U, and D. Here is a result using ordinal logistic regression:

 

dt = New Table( "4x4x3 Factorial",
	Add Rows( 48 ),
	New Table Variable( "Design", "4x4x3 Factorial" ),
	New Script(
		"Model",
		Fit Model(
			Effects( :S, :U, :D, :S * :U, :S * :D, :U * :D ),
			Y( :Y ),
			PERSONALITY( Standard Least Squares )
		)
	),
	New Script( "Evaluate Design", DOE( Evaluate Design, X( :S, :U, :D ) ) ),
	New Script(
		"DOE Dialog",
		DOE(
			Full Factorial Design,
			{Add Response( Maximize, "Y", ., ., . ),
			Add Factor( Categorical, {"1", "2", "3", "4"}, "S", 0 ),
			Add Factor( Categorical, {"1", "2", "3", "4"}, "U", 0 ),
			Add Factor( Categorical, {"1", "2", "3"}, "D", 0 ),
			Set Random Seed( 873 ), Make Design, Simulate Responses( 0 ),
			Set Run Order( Sort Left to Right ), Make Table}
		)
	),
	New Script(
		"Graph Builder",
		Graph Builder(
			Size( 566, 1456 ),
			Show Control Panel( 0 ),
			Show Legend( 0 ),
			Variables( Y( :Y ), Page( :D ), Group X( :U ), Group Y( :S ) ),
			Elements( Points( Y, Legend( 7 ) ) ),
			SendToReport(
				Dispatch(
					{},
					"400",
					ScaleBox,
					{Legend Model(
						7,
						Properties( -1, {Line Color( 4 )}, Item ID( "1", 1 ) ),
						Properties( -1, {Line Color( 41 )}, Item ID( "2", 1 ) ),
						Properties( -1, {Line Color( 3 )}, Item ID( "3", 1 ) )
					)}
				)
			)
		)
	),
	New Column( "Pattern",
		Character,
		"Nominal",
		Set Values(
			{"111", "112", "113", "121", "122", "123", "131", "132", "133", "141",
			"142", "143", "211", "212", "213", "221", "222", "223", "231", "232",
			"233", "241", "242", "243", "311", "312", "313", "321", "322", "323",
			"331", "332", "333", "341", "342", "343", "411", "412", "413", "421",
			"422", "423", "431", "432", "433", "441", "442", "443"}
		)
	),
	New Column( "S",
		Character,
		"Nominal",
		Set Property( "Value Ordering", {"1", "2", "3", "4"} ),
		Set Property( "Design Role", DesignRole( Categorical ) ),
		Set Property( "Factor Changes", Easy ),
		Set Values(
			{"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "2", "2",
			"2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "3", "3", "3", "3",
			"3", "3", "3", "3", "3", "3", "3", "3", "4", "4", "4", "4", "4", "4",
			"4", "4", "4", "4", "4", "4"}
		)
	),
	New Column( "U",
		Character,
		"Nominal",
		Set Property( "Value Ordering", {"1", "2", "3", "4"} ),
		Set Property( "Design Role", DesignRole( Categorical ) ),
		Set Property( "Factor Changes", Easy ),
		Set Values(
			{"1", "1", "1", "2", "2", "2", "3", "3", "3", "4", "4", "4", "1", "1",
			"1", "2", "2", "2", "3", "3", "3", "4", "4", "4", "1", "1", "1", "2",
			"2", "2", "3", "3", "3", "4", "4", "4", "1", "1", "1", "2", "2", "2",
			"3", "3", "3", "4", "4", "4"}
		)
	),
	New Column( "D",
		Character,
		"Nominal",
		Set Property( "Value Ordering", {"1", "2", "3"} ),
		Set Property( "Design Role", DesignRole( Categorical ) ),
		Set Property( "Factor Changes", Easy ),
		Set Values(
			{"1", "2", "3", "1", "2", "3", "1", "2", "3", "1", "2", "3", "1", "2",
			"3", "1", "2", "3", "1", "2", "3", "1", "2", "3", "1", "2", "3", "1",
			"2", "3", "1", "2", "3", "1", "2", "3", "1", "2", "3", "1", "2", "3",
			"1", "2", "3", "1", "2", "3"}
		)
	),
	New Column( "Y",
		Numeric,
		"Ordinal",
		Format( "Best", 12 ),
		Value Labels( {1 = "Low", 2 = "Med", 3 = "High"} ),
		Use Value Labels( 1 ),
		Set Values(
			[1, 1, 2, 1, 1, 2, 1, 2, 3, 2, 3, 3, 1, 1, 2, 1, 1, 2, 1, 2, 3, 2, 3, 3,
			1, 1, 2, 1, 2, 3, 2, 3, 3, 2, 3, 3, 1, 2, 3, 2, 3, 3, 2, 3, 3, 2, 3, 3]
		)
	),
	Set Label Columns( :Pattern )
);

dt << Fit Model(
	Y( :Y ),
	Effects( :S, :U, :D ),
	Personality( "Ordinal Logistic" ),
	Run(
		Likelihood Ratio Tests( 1 ),
		Profiler(
			1,
			Term Value(
				S( "1", Lock( 0 ), Show( 1 ) ),
				U( "1", Lock( 0 ), Show( 1 ) ),
				D( "1", Lock( 0 ), Show( 1 ) )
			)
		)
	)
);