Choose Language Hide Translation Bar
Highlighted
viskovicz00012
Level II

Append for Loop PValue Table

I'm kinda lost with having to append the Pvalues table to a new data table from the Response Screening. There seems to be something missing with my script? Need help with this. Thanks!

 

For( i = 1, i <= N Items( new_b ), i++,
        rsq = cor_tab << Response Screening(
        Y( Column( cor_tab, new_t[i] ) ),
        X( Column( cor_tab, ref_t[i] ) )
)
  pv = data table("PValues");
        newdt << concatenate( datatable(pv), append to first table(1) );
);

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: Append for Loop PValue Table

You are pretty close to what you need.  You have some mismatched "()" and your concatenation statement is not within the For() loop.  Below is a rework of your code into a full working example.  I have also added a second version which I believe will give you more informative results.

Names Default To Here( 1 );
cor_tab = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

// Build the New_t and Ref_t lists
allCols = dt << get column names( continuous );
// Place every other column in the new_t and ref_t
new_t = {};
ref_t = {};
For( i = 1, i <= N Items( allCols ), i++,
	If( Mod( i, 2 ) == 0,
		Insert Into( ref_t, allCols[i] ),
		Insert Into( new_t, allCols[i] )
	)
);


dtFinal = New Table( "Together" );
For( i = 1, i <= N Items( new_t ), i++,
	rsq = cor_tab << Response Screening(
		Y( Column( cor_tab, new_t[i] ) ),
		X( Column( cor_tab, ref_t[i] ) )
	);
	dtFinal << concatenate( Data Table( "PValues"), append to first table( 1 ) );
	Close( Data Table( "PValues" ), nosave );
);

// Or if you did it this way, you would get more informative results table

cor_tab << Response Screening( Y( eval(new_t) ), X( eval(ref_t) ), Paired X and Y( 1 ) );
Jim

View solution in original post

1 REPLY 1
Highlighted
txnelson
Super User

Re: Append for Loop PValue Table

You are pretty close to what you need.  You have some mismatched "()" and your concatenation statement is not within the For() loop.  Below is a rework of your code into a full working example.  I have also added a second version which I believe will give you more informative results.

Names Default To Here( 1 );
cor_tab = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

// Build the New_t and Ref_t lists
allCols = dt << get column names( continuous );
// Place every other column in the new_t and ref_t
new_t = {};
ref_t = {};
For( i = 1, i <= N Items( allCols ), i++,
	If( Mod( i, 2 ) == 0,
		Insert Into( ref_t, allCols[i] ),
		Insert Into( new_t, allCols[i] )
	)
);


dtFinal = New Table( "Together" );
For( i = 1, i <= N Items( new_t ), i++,
	rsq = cor_tab << Response Screening(
		Y( Column( cor_tab, new_t[i] ) ),
		X( Column( cor_tab, ref_t[i] ) )
	);
	dtFinal << concatenate( Data Table( "PValues"), append to first table( 1 ) );
	Close( Data Table( "PValues" ), nosave );
);

// Or if you did it this way, you would get more informative results table

cor_tab << Response Screening( Y( eval(new_t) ), X( eval(ref_t) ), Paired X and Y( 1 ) );
Jim

View solution in original post

Article Labels

    There are no labels assigned to this post.