Highlighted  David_Burnham
Super User

## Nonlinear Fit SSE Grid

I want to program a grid search prior to a nonlinear fit.

SSE grid gives me what I want, but it doesn't look like it is scriptable? (i.e. I want to automate it fully).

Any ideas?

Dave

-Dave
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

## Re: Nonlinear Fit SSE Grid

Not sure I understand what you want, but if the goal is to use the SSE Grid for improving the initial parameter settings, the approach below may be useful and quite fast.

dt = Open( "\$SAMPLE_DATA/Nonlinear Examples/US Population.jmp" );

h = {"Min", "Max", "Number?"}; // colbox headers

m = [12 17 10,

0.005 0.03 10]; // Input ranges for the grid

nl = dt << Nonlinear( Y( :pop ), X( :Name( "X-formula" ) ), SSE grid );

// Specify the grid and make table

grid_ob = Report( nl )[Outline Box( "specify?" )];

For( i = 1, i <= 3, i++,

grid_ob[Number Col Box( h[i] )] << set values( m[0, i] )

);

grid_ob << click;

dt_grid = Current Data Table();

//Find min SSE and make matrix of parameters

min_SSE=Loc Min( Column( dt_grid, "SSE" ) << get as matrix);

init_params = Matrix(

Repeat(

i = 0;

{i++ ; Column( dt_grid, i )[min_SSE]};,

N Row( m )

)

);

// Set initial parameters and finish

Report( nl )[Number Col Edit Box( "Current Value" )] << set values( init_params );

nl << finish;

5 REPLIES 5
Highlighted  David_Burnham
Super User

## Re: Nonlinear Fit SSE Grid

My question was specifically whether the SSE Grid message could be fully programmed.

I have another way which I think will work:

- set iteration limit to zero

- perform the fit

- extract the SSE value

do all this in a grid search loop.

I think that will work, so I don't need an answer unless someone knows some hidden parameters for the SSE Grid message

-Dave
Highlighted  David_Burnham
Super User

## Re: Nonlinear Fit SSE Grid

The approach I described worked but is much slower than I would like.

So still looking to code up SSE Grid - or figure out how it does it so fast that I can code it up myself

-Dave
Highlighted

## Re: Nonlinear Fit SSE Grid

Not sure I understand what you want, but if the goal is to use the SSE Grid for improving the initial parameter settings, the approach below may be useful and quite fast.

dt = Open( "\$SAMPLE_DATA/Nonlinear Examples/US Population.jmp" );

h = {"Min", "Max", "Number?"}; // colbox headers

m = [12 17 10,

0.005 0.03 10]; // Input ranges for the grid

nl = dt << Nonlinear( Y( :pop ), X( :Name( "X-formula" ) ), SSE grid );

// Specify the grid and make table

grid_ob = Report( nl )[Outline Box( "specify?" )];

For( i = 1, i <= 3, i++,

grid_ob[Number Col Box( h[i] )] << set values( m[0, i] )

);

grid_ob << click;

dt_grid = Current Data Table();

//Find min SSE and make matrix of parameters

min_SSE=Loc Min( Column( dt_grid, "SSE" ) << get as matrix);

init_params = Matrix(

Repeat(

i = 0;

{i++ ; Column( dt_grid, i )[min_SSE]};,

N Row( m )

)

);

// Set initial parameters and finish

Report( nl )[Number Col Edit Box( "Current Value" )] << set values( init_params );

nl << finish;

Highlighted  David_Burnham
Super User

## Re: Nonlinear Fit SSE Grid

Spot on!  Thanks MS

-Dave
Highlighted  David_Burnham
Super User

## Re: Nonlinear Fit SSE Grid

I will code up the SSE calculation myself without using the platform.  This should be as fast as the SSE Grid unless it is doing something really clever.

Consider this closed.

-Dave
Article Labels

There are no labels assigned to this post.