Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- JMP User Community
- :
- Discussions
- :
- Accessing Outline Box NIPALS Fit in JSL

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Aug 24, 2020 7:05 AM
(277 views)

I want to dynamically access the fit part of the PLS report ("NIPALS fit with x factors"). I know that I can access it if I know the number of the outline box (e.g., OutlineBox(6)) or the exact title, but since the number of the former could change and the latter changes depending on the number of factors, I have trouble dynamically accessing the outline box.

Is there a way of getting the tree position of a outline box by searching for part of its name?

2 ACCEPTED SOLUTIONS

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

You could use xpath to search all outline boxes by name.

`pls report << XPath("//OutlineBox[ contains( text(), 'NIPALS Fit with' ) ]");`

Example:

```
names default to here(1);
dt = Open( "$Sample_data/iris.jmp" );
pls = Partial Least Squares(
Y( :Petal width ),
X( :Sepal length, :Sepal width, :Petal length ),
Validation Method( KFold( 7 ), Initial Number of Factors( 3 ) ),
Fit( Method( NIPALS ), Number of Factors( 3 ) ),
Fit( Method( NIPALS ), Number of Factors( 2 ) )
);
//get all matching outline boxes:
ob = pls << XPath("//OutlineBox[ contains( text(), 'NIPALS Fit with' ) ]");
//Reference the first match:
ob[1] << Prepend ( Spacer Box( size( 800, 5 ), color( "red" ) ) );
```

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

With the snippet

```
mywind=Window() << Get Window Title;
pls_wind = {};
For( i = 1, i <= N Items( mywind ), i++,
If( Contains( mywind[i], "Partial Least Squares"),
Insert Into( pls_wind, mywind[i] )
)
);
ob = Window( pls_wind[1] ) << XPath("//OutlineBox[ contains( text(), 'NIPALS Fit with' ) ]");
```

I can access the PLS window and send messages, so that seems to work.

4 REPLIES 4

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

You could use xpath to search all outline boxes by name.

`pls report << XPath("//OutlineBox[ contains( text(), 'NIPALS Fit with' ) ]");`

Example:

```
names default to here(1);
dt = Open( "$Sample_data/iris.jmp" );
pls = Partial Least Squares(
Y( :Petal width ),
X( :Sepal length, :Sepal width, :Petal length ),
Validation Method( KFold( 7 ), Initial Number of Factors( 3 ) ),
Fit( Method( NIPALS ), Number of Factors( 3 ) ),
Fit( Method( NIPALS ), Number of Factors( 2 ) )
);
//get all matching outline boxes:
ob = pls << XPath("//OutlineBox[ contains( text(), 'NIPALS Fit with' ) ]");
//Reference the first match:
ob[1] << Prepend ( Spacer Box( size( 800, 5 ), color( "red" ) ) );
```

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Accessing Outline Box NIPALS Fit in JSL

@ih: When I try your way with my example, I get the error message:

I'm calling the PLS using

```
pls = Partial Least Squares(
Validation( :Validation ),
Initial Number of Factors( 15 ),
Centering( 0 ),
Scaling( 0 ),
Fit(
Method( NIPALS ),
Distance Plots( 1 ),
Diagnostics Plots( 1 ),
Overlay Loadings Plots( 1 ),
VIP vs Coefficients Plots( 1 ),
T Square Plot( 1 ),
Correlation Loading Plot( 2 ),
Overlay Coefficients Plots( 1 )
)
);
```

because I need the PLS dialog to prompt for X and Y.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Accessing Outline Box NIPALS Fit in JSL

It appears as if the "pls" pointer to the Partial Least Squares() platform gets lost when it has to pop up for X and Y input. So below is a real kluge of a solution, that uses a reference to the name of the output window that will be produced for the example, and keeps checking to see when it appears, and then applies the red line. I don't like the solution....hopefully another Community member has a better solution

```
Names Default To Here( 1 );
dt = Open( "$Sample_data/iris.jmp" );
pls = Partial Least Squares(
Validation Method( KFold( 7 ), Initial Number of Factors( 3 ) ),
Fit( Method( NIPALS ), Number of Factors( 3 ) ),
Fit( Method( NIPALS ), Number of Factors( 2 ) )
);
ob = "";
counter = 0;
While( ob == "",
Wait( 5 );
ob = Try( Window( "iris - Partial Least Squares of Petal width" ) << XPath( "//OutlineBox[ contains( text(), 'NIPALS Fit with' ) ]" ), "" );
Try( ob[1] << Prepend( Spacer Box( size( 800, 5 ), color( "red" ) ) ) );
);
```

Jim

- Tags:
- see

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

With the snippet

```
mywind=Window() << Get Window Title;
pls_wind = {};
For( i = 1, i <= N Items( mywind ), i++,
If( Contains( mywind[i], "Partial Least Squares"),
Insert Into( pls_wind, mywind[i] )
)
);
ob = Window( pls_wind[1] ) << XPath("//OutlineBox[ contains( text(), 'NIPALS Fit with' ) ]");
```

I can access the PLS window and send messages, so that seems to work.