cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
dp30
Level IV

Get relative prediction variance values

Hello,

I would like to make ternary plots showing the relative prediction variance of 3-component mixture DOEs.

To do that, I would need to extract a high number of values (let's say 20,000) from the Prediction Variance Profile graph, and make a datatable with these values. This datatable would have 20,000 rows and 4 columns: X1, X2, X3 and the Relative Prediction Variance.

Perhaps another way to do that, would be to use the Column Formula Editor and implement the relative prediction variance formula, but I am not familiar with matrix functions in the Formula Editor.

Thanks a lot.

By the way, this would be a nice feature for next JMP updates

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Get relative prediction variance values

This script illustrates an approach for three components, X1, X2, X3, and the quadratic Scheffe model.

 

Names Default to Here( 1 );

// make design
doe = DOE(
	Custom Design,
	{Add Response( Maximize, "Y", ., ., . ), Add Factor( Mixture, 0, 1, "X1", 0 ),
	Add Factor( Mixture, 0, 1, "X2", 0 ), Add Factor( Mixture, 0, 1, "X3", 0 ),
	Set Random Seed( 27513 ), Number of Starts( 10000 ), Add Term( {1, 1} ),
	Add Term( {2, 1} ), Add Term( {3, 1} ), Add Term( {1, 1}, {2, 1} ),
	Add Term( {1, 1}, {3, 1} ), Add Term( {2, 1}, {3, 1} ), Set Sample Size( 12 ),
	Simulate Responses( 0 ), Save X Matrix( 1 ), Make Design,
	Set Run Order( Randomize )}
);

// make design data table
doe dt = doe << Make Table;
doe << Close Window;

// get model matrix, X
model matrix expr = doe dt << Get Script( "Model Matrix" );
X = Arg( Arg( model matrix expr, 1 ), 2 );
inv x prime x = Inverse( X` * X );

// make expression for prediction variance
pv expr = Substitute(
	Expr(
		xi = Matrix( List( :X1, :X2, :X3, :X1*:X2, :X1*:X3, :X2*:X3 ) );
		xi` * iii * xi;
	),
	Expr( iii ), inv x prime x
);

// add data column with prediction variance formula
Eval(
	Substitute(
		Expr(
			doe dt << New Column( "Prediction Variance", Numeric, Continuous,
				Formula( fff )
			);
		),
		Expr( fff ), Name Expr( pv expr )
	)
);

// plot prediction variance
mp = doe dt << Mixture Profiler(
	Y( :Prediction Variance ),
	Mixture Profiler(
		1,
		Term Value(
			X1( 0.333333333333335, Lock( 0 ), Show( 1 ) ),
			X2( 0.333333333333336, Lock( 0 ), Show( 1 ) ),
			X3( 0.333333333333335, Lock( 0 ), Show( 1 ) )
		),
		Contour Value(
			Prediction Variance(
				0.5,
				Min( 0 ),
				Max( 1 )
			)
		),
		Top Factor( X1 ),
		Left Factor( X2 ),
		Right Factor( X3 )
	)
);
mp << Contour Grid( 0, 1, 0.1, :Prediction Variance );

View solution in original post

8 REPLIES 8

Re: Get relative prediction variance values

I'm a little confused on what you are looking to do.

 

Since you have DOE data and are looking at a profiler, you have a model. Have you looked at the mixture profiler that comes as part of the model-fitting of a mixture model? You can add a contour grid to the mixture profiler that will give a ternary plot based on your model.

 

If you still want to use the contour plots from Graph > Ternary Plot, then save your prediction formula from the model fitting. Specify the prediction formula in the contour field of the Ternary Plot dialog. That will give you smooth contours. There is no need to create a data table with thousands of rows unless I am missing something.

Dan Obermiller
dp30
Level IV

Re: Get relative prediction variance values

What I want to do is to plot the values of the relative variance of prediction as a function of the X's by using a ternary plot (no need Y's values for doing that).
Thanks

Re: Get relative prediction variance values

JMP provides a profiler and the Fraction of Design Plot for the prediction variance expected with any design, including a mixture experiment. These two visualizations of the prediction variance are available in the Design Evaluation outline. They are automatically produced after clicking Make Design.

 

If you already have a design, you can alternatively select DOE > Design Diagnostics > Evaluate Design with a data table open and add data columns to the factor role. The same two visualizations are available.

dp30
Level IV

Re: Get relative prediction variance values

I know the Prediction Variance Profile and the FDS plot, unfortunately these two platforms can't show prediction variance values in a ternary plot (i.e. a triangle with X1, X2, X3 as variables and prediction variance as response).

Re: Get relative prediction variance values

You can use the standard formula for the linear regression if you want to create your own visualization. The formula is provided in the Help > Books > Design of Experiments guide. See the chapter about statistical details. Here is the relevant information:

 

Screen Shot 2019-12-31 at 7.51.32 AM.png

 

The result in the lower right is the relative prediction variance, which is the quantity plotted in the Prediction Variance Profiler and the FDS Plot. Multiply this result by the actual response variance to make and absolute result if you like.

dp30
Level IV

Re: Get relative prediction variance values

Yes you're right Mark, thanks. Indeed my initial idea was to use the Formula Editor to calculate the

Prediction variance formula.png

expression.

 

But as I said I am not familiar with Matrix functions in the Formula Editor and I didn't manage to do it... 

 

Re: Get relative prediction variance values

This script illustrates an approach for three components, X1, X2, X3, and the quadratic Scheffe model.

 

Names Default to Here( 1 );

// make design
doe = DOE(
	Custom Design,
	{Add Response( Maximize, "Y", ., ., . ), Add Factor( Mixture, 0, 1, "X1", 0 ),
	Add Factor( Mixture, 0, 1, "X2", 0 ), Add Factor( Mixture, 0, 1, "X3", 0 ),
	Set Random Seed( 27513 ), Number of Starts( 10000 ), Add Term( {1, 1} ),
	Add Term( {2, 1} ), Add Term( {3, 1} ), Add Term( {1, 1}, {2, 1} ),
	Add Term( {1, 1}, {3, 1} ), Add Term( {2, 1}, {3, 1} ), Set Sample Size( 12 ),
	Simulate Responses( 0 ), Save X Matrix( 1 ), Make Design,
	Set Run Order( Randomize )}
);

// make design data table
doe dt = doe << Make Table;
doe << Close Window;

// get model matrix, X
model matrix expr = doe dt << Get Script( "Model Matrix" );
X = Arg( Arg( model matrix expr, 1 ), 2 );
inv x prime x = Inverse( X` * X );

// make expression for prediction variance
pv expr = Substitute(
	Expr(
		xi = Matrix( List( :X1, :X2, :X3, :X1*:X2, :X1*:X3, :X2*:X3 ) );
		xi` * iii * xi;
	),
	Expr( iii ), inv x prime x
);

// add data column with prediction variance formula
Eval(
	Substitute(
		Expr(
			doe dt << New Column( "Prediction Variance", Numeric, Continuous,
				Formula( fff )
			);
		),
		Expr( fff ), Name Expr( pv expr )
	)
);

// plot prediction variance
mp = doe dt << Mixture Profiler(
	Y( :Prediction Variance ),
	Mixture Profiler(
		1,
		Term Value(
			X1( 0.333333333333335, Lock( 0 ), Show( 1 ) ),
			X2( 0.333333333333336, Lock( 0 ), Show( 1 ) ),
			X3( 0.333333333333335, Lock( 0 ), Show( 1 ) )
		),
		Contour Value(
			Prediction Variance(
				0.5,
				Min( 0 ),
				Max( 1 )
			)
		),
		Top Factor( X1 ),
		Left Factor( X2 ),
		Right Factor( X3 )
	)
);
mp << Contour Grid( 0, 1, 0.1, :Prediction Variance );
dp30
Level IV

Re: Get relative prediction variance values

Wonderful! Thank you so much Mark