Subscribe Bookmark RSS Feed

Re: Generalized Regression interactive solution path

matteo_patelmo

Community Trekker

Joined:

Dec 23, 2015

Hello, in a script of mine I would like to detect the moment  an user interacts with the solution path in gen reg (by dragging the vertcal line in the solution path graph), in order to generate some custom charts based on the selected model.  Any suggestion? Thanks in advance Matteo

1 REPLY
Highlighted
matteo_patelmo

Community Trekker

Joined:

Dec 23, 2015

I found a possible solution using mousetrap(), alas with some drawbacks

1) on the first user click inside the solution path frame, a refresh button will appear. After that, the interactivity of the solution path is restored as usual.

2) when the user clicks on refresh button, the initial situation is restored. 

 

I will then place model elaborations functions inside the refresh button script.

 

I was looking for a better solution not so visibile to the user / not requiring intervention, I'd be glad if anyone could give a suggestion to improve the code below.

 

thanks
Matteo

 

 

 

m = Fit Model(
	Y( :Y ),
	Effects( :X1, :X2, :X3 ),
	Personality( "Generalized Regression" ),
	Generalized Distribution( "Normal" ),
	Run( Fit( Estimation Method( Lasso( Adaptive ) ), Validation Method( AICc ) ) )
);

f1 = (m << report)[Outline Box( "Solution Path" )][frame box( 1 )];
f2 = (m << report)[Outline Box( "Solution Path" )][frame box( 2 )];


setSolutionPathTraps = Function( {fb1, fb2, bb},
	Eval(
		Eval Expr(
			fb1 << add graphics script(
				Mousetrap(
					bb << visibility( "visible" ),
					Expr( fb2 ) << remove graphics script( 1 );
					Expr( fb1 ) << remove graphics script( 1 );
				)
			);
			fb2 << add graphics script(
				Mousetrap(
					bb << visibility( "visible" ),
					Expr( fb1 ) << remove graphics script( 1 );
					Expr( fb2 ) << remove graphics script( 1 );
				)
			);
		)
	);
	bb << visibility( "collapse" );
);

New Window( "a", bb = Button Box( "Refresh", setSolutionPathTraps( f1, f2, bb ) ) );


setSolutionPathTraps( f1, f2, bb );