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

Automating Local Filters/ Data Filters

I have a linear regression model for 4 different temperatures. I have put a local data filter on each one which allows me to specify the segment of data. 

The code for this calls each value in my source table 2 column as shown below. I want this to be automated so there may be more or less temperatures and I don't want to edit the code each time. There probably is a way through JSL script which I try to avoid writing myself and instead use workflow. I have added a data filter in which works exactly as wanted as long as the local filters are there as well. If I remove the local filters the data filter stops working in the same way. 

How can I change the Data filter to make the local filters redundant?

If not possible how would I go about coding the local filters to be automatic?

 

Data Table("Sorted") << Data Filter(
	Location({890, 387}),
	Mode(Include(1)),
	Add Filter(columns(:Segment), Where(:Segment == -100), Display(:Segment, N Items(8)))
);
 
Data Table("Sorted") << Fit Model(
	SendToByGroup(Bygroup Default),
	Y(:VCE),
	By(:Source Table 2),
	Effects(:ICE),
	Personality("Standard Least Squares"), 
//Emphasis( "Effect Leverage" ),
	Run(
		:VCE << {Summary of Fit(0), Analysis of Variance(0), Parameter Estimates(0), Lack of Fit(0),
		Scaled Estimates(0), Plot Actual by Predicted(0), Plot Residual by Predicted(0),
		Plot Studentized Residuals(0), Plot Effect Leverage(0), Plot Residual by Normal Quantiles(0),
		Box Cox Y Transformation(0)}
	),
	SendToByGroup(
		{:Source Table 2 == "25C"},
		Local Data Filter(Add Filter(columns(:Segment), Display(:Segment, N Items(8))))
	),
	SendToByGroup(
		{:Source Table 2 == "150C"},
		Local Data Filter(Add Filter(columns(:Segment), Display(:Segment, N Items(8))))
	),
	SendToByGroup(
		{:Source Table 2 == "125C"},
		Local Data Filter(Add Filter(columns(:Segment), Display(:Segment, N Items(8))))
	),
	SendToByGroup(
		{:Source Table 2 == "100C"},
		Local Data Filter(Add Filter(columns(:Segment), Display(:Segment, N Items(8))))
	)
);
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Automating Local Filters/ Data Filters

I suspect the issue is with the Automatic ReCalc option on the JMP platform(s) you are using. 

Go to the red triangle and select

     Redo=>Automatic ReCalc

That should permit the changing of all of the display with a change in the Data Filter.

Jim

View solution in original post

6 REPLIES 6
jthi
Super User

Re: Automating Local Filters/ Data Filters

I'm not exactly sure what you are trying to do here? Are you possibly just missing Show(1) from your data filter to hide excluded values?

jthi_0-1699377891323.png

 

-Jarmo

Re: Automating Local Filters/ Data Filters

Sorry I was not clear in my explanation. I now have show and include selected and this does work better. The data filter adjusts the analysis as long as there is a local filter.

I either want to not need the local filters (but I think this is harder for you to help with). Or I want the local filters to not specifically call the source table values (as this changes each time). 

 

 

Re: Automating Local Filters/ Data Filters

Are you using different where clauses in the multiple filters, or are you selecting the same range in each one?  I ask because it might be easier to have just one filter instead of multiple if you want the same conditions for each sub-group.

Re: Automating Local Filters/ Data Filters

Sorry for the confusion!

Yes I want the same condition for each one. I would like to have 1 filter that changes them all. 

I have tried the data filter and I can use this correctly when there is local filters. If I remove the local filters the data filter does not change the analysis and instead just high lights the points.

txnelson
Super User

Re: Automating Local Filters/ Data Filters

I suspect the issue is with the Automatic ReCalc option on the JMP platform(s) you are using. 

Go to the red triangle and select

     Redo=>Automatic ReCalc

That should permit the changing of all of the display with a change in the Data Filter.

Jim

Re: Automating Local Filters/ Data Filters

To have one filter across a by-group, I would suggest something like this:

dt = Open("$SAMPLE_DATA/Big Class.jmp");
New Window("report",
	Data Filter Context Box(
		HListBox(
			dt << Data Filter(Local, Columns(:age)),
			VListBox(
				dt << Bivariate(X(:height),Y(:weight),By(:sex))
			)
		)
	)
);

In JMP18 it will be easier to share a single filter across a by-group interactively rather than through scripting, but this script should work back several releases and will work in the future as well.