- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Calculating Yield using Tabulate
Hi all,
I'm currently trying to write a script that will automatically calculate yields of tests across temperatures. I've replaced all "Pass" with 1's and "Fail" with a 0 throughout the table then calculated the sum. Below is my current Tabulate window and the code for this. My goal is to have a third column for each temperature with the yield which is = ((Sum at Temp)/(N at Temp)) x 100. I'm having difficulties implementing this. I figure there is either a way to do this in Tabulate or to insert a Yield column after each "N" column and calculate the yield using the previous two columns in a formula, but am having trouble thinking how to do that in a way that accounts for a variable number of columns and test temperatures. Any help would be appreciated! Thanks in advance!
list = dt << Get Column Names( string );
Remove From(list, 1, testIndex);
yieldByTest = (dt << Tabulate(
Add Table(
Column Table(
Grouping Columns(:tst_temp),
Statistics(Sum, N, Mean)
),
Row Table(
Analysis Columns(Eval(list))
)
),invisible
)
) << Make Into data Table;
yieldByTest << Set Name("Yield by Test Across Temperature");
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Calculating Yield using Tabulate
I think this can be done like this example below.
Names Default To Here( 1 );
// generate yield table
dt1 = New Table( "dt1", add rows( 9 ), New Column( "Process", "Character", values( Repeat( {"A", "B", "C"}, 3 ) ) ) );
dt2 = New Table( "dt2", add rows( 9 ), New Column( "Temperature", "Nominal", values( Repeat( {30, 40, 50}, 3 ) ) ) );
dty = dt1 << join( with( dt2 ), Cartesian Join );
For Each( {dt}, {dt1, dt2}, Close( dt, "NoSave" ) );
dty << set name( "yield" );
dty << New Column( "yield", "Numeric", "Continuous", set each value( Random Integer( 0, 1 ) ) );
// tabulate
dty << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Grouping Columns( :Temperature ), Statistics( Sum, N, Mean ), Analysis Columns( :yield ) ),
Row Table( Grouping Columns( :Process ) )
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Calculating Yield using Tabulate
It might be easier to calculate yield by using Summary instead of tabulate:
If you want to use tabulate it might be easiest by using % Coluimn or % Row depending on how your data is formatted and still you might end up with a bit weird looking table:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Calculating Yield using Tabulate
I think this can be done like this example below.
Names Default To Here( 1 );
// generate yield table
dt1 = New Table( "dt1", add rows( 9 ), New Column( "Process", "Character", values( Repeat( {"A", "B", "C"}, 3 ) ) ) );
dt2 = New Table( "dt2", add rows( 9 ), New Column( "Temperature", "Nominal", values( Repeat( {30, 40, 50}, 3 ) ) ) );
dty = dt1 << join( with( dt2 ), Cartesian Join );
For Each( {dt}, {dt1, dt2}, Close( dt, "NoSave" ) );
dty << set name( "yield" );
dty << New Column( "yield", "Numeric", "Continuous", set each value( Random Integer( 0, 1 ) ) );
// tabulate
dty << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Grouping Columns( :Temperature ), Statistics( Sum, N, Mean ), Analysis Columns( :yield ) ),
Row Table( Grouping Columns( :Process ) )
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Calculating Yield using Tabulate
Using the mean makes sense. I can't believe I didn't think of that!