Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Highlighted

## bootstrapping 2 simultaneous tables

I'm wondering if anyone knows how to bootstrap or simulate two separate tables at once.  For instance.

``````Names default to here(1);
dt = open("\$SAMPLE_DATA\Big Class.jmp");
dt << Fit Model(
Y( :height ),
Effects( :weight, :age, :weight * :age ),
Personality( "Generalized Regression" ),
Generalized Distribution( "Normal" ),
Run(
Fit( Estimation Method( Lasso ), Validation Method( AICc ) )
),
);``````

Let's say I want to get the AICc of the values  for this model in a bootstrap and have that line up with the estimates of a bootstrap?

Can I just give them both the same random seed? If so, wouldn't that make the bootstrap take twice as long?

*Edit* Well it looks like bootstrapping isn't multithreaded (from what I can tell), but Parallel  Assign can't use displayboxes  anyway.  Crap.

Vince Faller - Predictum
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

## Re: bootstrapping 2 simultaneous tables

Hi Vince,

I think this script should show you how to do it. I don't know of an interactive way to do it, but you can use JSL to select multiple columns in the report and then send the Bootstrap message to one of them. The bootstrap is then performed on all tables that have a selected column. See the example below for a way to get the parameter estimates along with the corresponding AICc value.

``````Names default to here(1);
dt = open("\$SAMPLE_DATA\Big Class.jmp");
fm = dt << Fit Model(
Y( :height ),
Effects( :weight, :age, :weight * :age ),
Personality( "Generalized Regression" ),
Generalized Distribution( "Normal" ),
Run(
Fit( Estimation Method( Lasso ), Validation Method( AICc ) )
),
);

rpt = report(fm)["Normal Lasso with AICc Validation"];
rpt["Model Summary"][NumberColBox("")] << select;
rpt["Parameter Estimates for Original Predictors"][NumberColBox("Estimate")] << select;

randomreset(10373520);

dtlst = rpt["Parameter Estimates for Original Predictors"][NumberColBox("Estimate")] << Bootstrap(10, Fractional Weights(1));

dtlst << Set Name("Measure Results");
dtlst << Set Name("Parameter Estimates");

dtnew = dtlst << Join(
With( dtlst ),
By Matching Columns( :Name( "BootID•" ) = :Name( "BootID•" ) ),
Select( dtlst << Get Column Names ),
Select With( :AICc ),
Preserve Main Table Order( 1 ),
Drop Multiples( 0, 0 )
)``````

Hope that helps,

Michael

Michael Crotty
Sr Statistical Writer
JMP Development
4 REPLIES 4
Highlighted

## Re: bootstrapping 2 simultaneous tables

Hi Vince,

I think this script should show you how to do it. I don't know of an interactive way to do it, but you can use JSL to select multiple columns in the report and then send the Bootstrap message to one of them. The bootstrap is then performed on all tables that have a selected column. See the example below for a way to get the parameter estimates along with the corresponding AICc value.

``````Names default to here(1);
dt = open("\$SAMPLE_DATA\Big Class.jmp");
fm = dt << Fit Model(
Y( :height ),
Effects( :weight, :age, :weight * :age ),
Personality( "Generalized Regression" ),
Generalized Distribution( "Normal" ),
Run(
Fit( Estimation Method( Lasso ), Validation Method( AICc ) )
),
);

rpt = report(fm)["Normal Lasso with AICc Validation"];
rpt["Model Summary"][NumberColBox("")] << select;
rpt["Parameter Estimates for Original Predictors"][NumberColBox("Estimate")] << select;

randomreset(10373520);

dtlst = rpt["Parameter Estimates for Original Predictors"][NumberColBox("Estimate")] << Bootstrap(10, Fractional Weights(1));

dtlst << Set Name("Measure Results");
dtlst << Set Name("Parameter Estimates");

dtnew = dtlst << Join(
With( dtlst ),
By Matching Columns( :Name( "BootID•" ) = :Name( "BootID•" ) ),
Select( dtlst << Get Column Names ),
Select With( :AICc ),
Preserve Main Table Order( 1 ),
Drop Multiples( 0, 0 )
)``````

Hope that helps,

Michael

Michael Crotty
Sr Statistical Writer
JMP Development
Highlighted

## Re: bootstrapping 2 simultaneous tables

That's great, thank you for sharing Michael!

Highlighted

## Re: bootstrapping 2 simultaneous tables

Cute.

I was trying to do that interactively, cool that I can just do it by scripting.

I've never seen `random reset()`,  it seems that it's the same as sending random seed() to `bootstrap`.  Pretty cool.

This seems to do exactly what I want.

Vince Faller - Predictum
Highlighted

## Re: bootstrapping 2 simultaneous tables

You could do the same thing by setting the random seed inside the Bootstrap() call. Random Reset() is just the function that enables you to set the internal seed for the random number generator at a specific time in your script.
Michael Crotty
Sr Statistical Writer
JMP Development
Article Labels

There are no labels assigned to this post.