Here are 3 methods to create the output table you want
// Generate the required table by creating output tables
// and then manipulating them to get the results
Names Default To Here( 1 );
// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Launch platform: Bivariate
biv = Bivariate( Y( :height ), X( :weight ), fit line );
// Output the Summary of Fit data and transfor the output table
// to a single row
rbiv = Report( biv );
bivsumfit = rbiv["Summary of Fit"][Table Box( 1 )] << make combined data table( invisible );
bivsumfit2 = bivsumfit << Split( Split By( :Column 1 ), Split( :Column 2 ), invisible );
Close( bivsumfit, nosave );
// Output the Parameter Estimate data and transfor the output table
// to a single row
bivparmest = rbiv["Parameter Estimates"][Table Box( 1 )] <<
make combined data table( invisible );
bivparmest2 = bivparmest << Split( Split By( :Term ), Split( :Estimate ) );
Close( bivparmest, nosave );
// Combine the 2 tables
bivparmest2 << Update( With( bivsumfit2 ), Match Columns( :X = :X, :Y = :Y ) );
Close( bivsumfit2, nosave );
// Clean up the final table
bivparmest2 << delete columns(
{"X", "Y", "Table", "Mean of Response", "Observations (or Sum Wgts)", "RSquare Adj", "~Bias",
"Std Error", "t Ratio", "Prob>|t|"}
);
bivparmest2:Intercept << set name( "Y Intercept" );
Column( bivparmest2, 2 ) << set name( "Slope" );
bivparmest2:Root Mean Square Error << set name( "RMSE" );
// Create the required ouput table by reading the results
// directly from the ouput report
names default to here(1);
// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Launch platform: Bivariate
biv = Bivariate( Y( :height ), X( :weight ), fit line );
// Create the new table
dtOut = New Table("Results",
Add Rows( 1 ),
New Column( "Slope" ),
New Column( "Y Intercept" ),
New Column( "Rsquare" ),
New Column( "RMSE" )
);
// Copy the table data to the output data table
rbiv = report( biv );
dtOut:Y Intercept[1] = rbiv["ParameterEstimates"][NumberColBox(1)][1];
dtOut:Slope[1] = rbiv["ParameterEstimates"][NumberColBox(1)][2];
dtOut:Rsquare[1] = rbiv["Summary of Fit"][NumberColBox(1)][1];
dtOut:RMSE[1] = rbiv["Summary of Fit"][NumberColBox(1)][3];
// Create the required ouput table using the Linear Regression
// function and adding in the RMSE
Names Default To Here( 1 );
// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Calculate the linear regression
x = dt:weight << get values;
y = dt:height << get values;
{Estimates, Std_Error, Diagnostics} = Linear Regression( y, X );
// calculate the RMSE
p = x * estimates[2] + estimates[1];
d = y - p;
RMSE = Sqrt( Sum( d d ) / (N Rows( d ) - 2) );
// Create the new table
dtOut = New Table( "Results",
Add Rows( 1 ),
New Column( "Slope" ),
New Column( "Y Intercept" ),
New Column( "Rsquare" ),
New Column( "RMSE" )
);
// Copy the calculated values to the output data table
dtOut:Y Intercept[1] = Estimates[1];
dtOut:Slope[1] = Estimates[2];
dtOut:Rsquare[1] = Diagnostics["RSquare"];
dtOut:RMSE[1] = RMSE;
Jim