Subscribe Bookmark RSS Feed

Script the nonlinear platform to lock variables before solving

pauldeen

Community Trekker

Joined:

Oct 24, 2014

In the nonlinear platform I can supply my own equation and then ask JMP so solve the coefficients. In the visual interface I can lock some of these parameters and give them a preset value. How do I do this in scripting?

 

dt = Open("$SAMPLE_DATA\Big Class.jmp");
dt << New Column( "PredictorFormula",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Formula(
			Parameter(
				{b0 = 0.5, b1 = 0.6, b2 = 0.7},
				b0 + b1 * :height + b2 * :height ^ 2
			)
		),
	);
nln = Nonlinear( Y( :weight ), X( :PredictorFormula ), By( :sex ), Newton );

Now I want to talk to nln and lock the second parameter (b1) in the first instance and change the default value to 0.55 and lock b2 in instance 2 with default value 1.

Using Xpath I'm able to select the NumberColEditBoxes and and change their values, but I cannot manipulate the lock checkmarks that way.

ValuesBoxes = nln << xpath("//NumberColEditBox/NumberColEditBoxHeader[text()='Current Value']/..");
templist = (ValuesBoxes[1] << get())[1];
templist[2] = 0.55;
ValuesBoxes[1] << set(templist);
templist = (ValuesBoxes[2] << get())[1];
templist[3] = 1;
ValuesBoxes[2] << set(templist);

I can select the checkbox column and query or set the first checkbox, but nothing more.

CheckBoxes = nln << xpath("//CheckBoxBox");
CheckBoxes[1] << get();
CheckBoxes[1] << set(1); //Only does a toggle of the first checkbox, cannot do any other checbox
2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Here is the example taken directly from the Scripting Index on locking parameters

     Help==>Scripting Index==>NonLinear==>Lock Parameter

Names Default To Here( 1 );
dt = Open(
	"$SAMPLE_DATA/Nonlinear Examples/CES Production Function.jmp"
);
obj = Nonlinear(
	Y( :Name( "log($ value)" ) ),
	X( :Model )
);
obj << Set Parameter( B0 = 0.2 );
obj << Lock Parameter( B0 );
obj << Finish;
Jim
pauldeen

Community Trekker

Joined:

Oct 24, 2014

Solution

And just after I posted the question I decided to try again and I figured out how to solve it:

CheckBoxes[1] << get(2);
CheckBoxes[1] << set(2,1);

This is how you check and set the second checkbox.

5 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Solution

Here is the example taken directly from the Scripting Index on locking parameters

     Help==>Scripting Index==>NonLinear==>Lock Parameter

Names Default To Here( 1 );
dt = Open(
	"$SAMPLE_DATA/Nonlinear Examples/CES Production Function.jmp"
);
obj = Nonlinear(
	Y( :Name( "log($ value)" ) ),
	X( :Model )
);
obj << Set Parameter( B0 = 0.2 );
obj << Lock Parameter( B0 );
obj << Finish;
Jim
pauldeen

Community Trekker

Joined:

Oct 24, 2014

That is maybe even better (certainly compacter), but does it allow to control each parameter in different levels of the by value?
pauldeen

Community Trekker

Joined:

Oct 24, 2014

Yes it does :)
Jeff_Perkinson

Community Manager

Joined:

Jun 23, 2011

From the Scripting Index, the Nonlinear platform accepts a Lock Parameter message.

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Nonlinear Examples/CES Production Function.jmp" );
obj = Nonlinear( Y( :Name( "log($ value)" ) ), X( :Model ) );
obj << Set Parameter( B0 = 0.2 );
obj << Lock Parameter( B0 );
obj << Finish;

JMPScreenSnapz106.png 

-Jeff
pauldeen

Community Trekker

Joined:

Oct 24, 2014

Solution

And just after I posted the question I decided to try again and I figured out how to solve it:

CheckBoxes[1] << get(2);
CheckBoxes[1] << set(2,1);

This is how you check and set the second checkbox.