cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
lehaofeng
Level IV

How to make expressions work in statements?

I used the loop to generate an expression factors() with the contents of the parentheses. But it doesn't work in DOE's data simulation statement.

fs = Expr(Factors(L1 << random(normal(0, 0.5)), L12 << random(normal(0, 0.5))) );
eval(evalexpr(dt << Profiler(
			Y( :Y ),
			Profiler(
				1,
				Simulator(
					1,
					Expr(fs), 
					
					Responses( Y << No Noise ),
					N Runs( 1000000 ),
					Resimulate
				)
			)
		)));
1 ACCEPTED SOLUTION

Accepted Solutions
Jasean
Staff

Re: How to make expressions work in statements?

In your profiler statement, you are telling JMP to evaluate the variable fs and place whatever is returned into the enclosing profiler launch expression.  In this case, you need the evaluation of fs to return the expression.  To see what fs returns when you evaluate it, you can highlight the variable and click the run button.  When you do this, JMP will error because it is trying to evaluate the expression.  That expression is not a valid JSL statement by itself.

 

In short, you do not want to evaluate the expression held by fs, you want to get the expression itself.  To do this, use the NameExpr() function.  Try this:

fs = Expr( Factors( L1 << random( normal( 0, 0.5 ) ), L12 << random( normal( 0, 0.5 ) ) ) );

Eval(
	Eval Expr(
		dt << Profiler(
			Y( :Y ),
			Profiler(
				1,
				Simulator(
					1,
					Expr( Name Expr( fs ) ), 
					
					Responses( Y << No Noise ),
					N Runs( 1000000 ),
					Resimulate
				)
			)
		)
	)
);

View solution in original post

4 REPLIES 4
Jasean
Staff

Re: How to make expressions work in statements?

In your profiler statement, you are telling JMP to evaluate the variable fs and place whatever is returned into the enclosing profiler launch expression.  In this case, you need the evaluation of fs to return the expression.  To see what fs returns when you evaluate it, you can highlight the variable and click the run button.  When you do this, JMP will error because it is trying to evaluate the expression.  That expression is not a valid JSL statement by itself.

 

In short, you do not want to evaluate the expression held by fs, you want to get the expression itself.  To do this, use the NameExpr() function.  Try this:

fs = Expr( Factors( L1 << random( normal( 0, 0.5 ) ), L12 << random( normal( 0, 0.5 ) ) ) );

Eval(
	Eval Expr(
		dt << Profiler(
			Y( :Y ),
			Profiler(
				1,
				Simulator(
					1,
					Expr( Name Expr( fs ) ), 
					
					Responses( Y << No Noise ),
					N Runs( 1000000 ),
					Resimulate
				)
			)
		)
	)
);
lehaofeng
Level IV

Re: How to make expressions work in statements?

谢谢你的快速回答,many thanks!

lehaofeng
Level IV

Re: How to make expressions work in statements?

I don't know why, but none of the code after Expr( Name Expr( fs ) ) works. Can you help me look at it? For example, N Runs( 1000000 )

Jasean
Staff

Re: How to make expressions work in statements?

If you are still having the problem, I'll be happy to look at it.  Can you post the data table you are using?