cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
Rober
Level I

Fit a model between data set and the generated slope

I would like to fit a model between the accelerated data set ( data from different time points at certain temp) and the slope of these points
Because I want to generate 400 pseudo data sets and fit the slope for each data set. Could JMP help me to do this.
I tried to get the slope as a formula but unfortunately, the profiler does not recognize the formula columns and I could not fit the time, outcome value, and slope in one line to repeat after adding the noise
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Fit a model between data set and the generated slope

Here is an example of a way to do this, if your input data resembles your attached picture of your Excel layout.

txnelson_0-1695560276471.png

 

names default to here(1);

// Create an example data table 
dt = 
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

dtExample = dt << Subset( columns(:NPN1, :NPN2, :NPN3, :NPN4), output table( "Example" ) );

// Close the semiconductor capability data table
close( dt, nosave );

// add the initial comparison slope as row 1
dtExample << Add Rows( 1, At Start );
:NPN1[1] = 0;
:NPN2[1] = 1;
:NPN3[1] = 3;
:NPN4[1] = 6;

// Create the Slope Column and add the formula 
dtExample << New Column( "Slope",
	formula(
		// Create the y matrix from the 4 columns at row 1;
		// The y matrix needs to be the transpose of row 1,
		// since the matrix needs to be a 4 row matrix, not
		// a 4 column matrix
		As Constant( x = current data table()[1, 1::4]` );
		// For all rows in the data table, except the first
		// create the y matrix(transposed) and then run the
		// regression, stripping out only the slope from
		// the Estimates list created from the linear regression
		If( Row() > 1,
			y = current data table()[Row(), 1::4]`;
			{Estimates, Std_Error, Diagnostics} = Linear Regression( y, x );
			slope = Abs( Estimates[2] );
		,
			slope = .
		);
	)
);


Jim

View solution in original post

6 REPLIES 6
Thierry_S
Super User

Re: Fit a model between data set and the generated slope

Hi,

Could you share an example (mock data is OK) of the data and formula you tried to use in the profiler? I cannot figure out how to approach your problem only with your short description above.

Thanks.

Best,

TS

Thierry R. Sornasse
Rober
Level I

Re: Fit a model between data set and the generated slope

I would like to make this function as the below image 

txnelson
Super User

Re: Fit a model between data set and the generated slope

Here is an example of a way to do this, if your input data resembles your attached picture of your Excel layout.

txnelson_0-1695560276471.png

 

names default to here(1);

// Create an example data table 
dt = 
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

dtExample = dt << Subset( columns(:NPN1, :NPN2, :NPN3, :NPN4), output table( "Example" ) );

// Close the semiconductor capability data table
close( dt, nosave );

// add the initial comparison slope as row 1
dtExample << Add Rows( 1, At Start );
:NPN1[1] = 0;
:NPN2[1] = 1;
:NPN3[1] = 3;
:NPN4[1] = 6;

// Create the Slope Column and add the formula 
dtExample << New Column( "Slope",
	formula(
		// Create the y matrix from the 4 columns at row 1;
		// The y matrix needs to be the transpose of row 1,
		// since the matrix needs to be a 4 row matrix, not
		// a 4 column matrix
		As Constant( x = current data table()[1, 1::4]` );
		// For all rows in the data table, except the first
		// create the y matrix(transposed) and then run the
		// regression, stripping out only the slope from
		// the Estimates list created from the linear regression
		If( Row() > 1,
			y = current data table()[Row(), 1::4]`;
			{Estimates, Std_Error, Diagnostics} = Linear Regression( y, x );
			slope = Abs( Estimates[2] );
		,
			slope = .
		);
	)
);


Jim
txnelson
Super User

Re: Fit a model between data set and the generated slope

Thinking further on your request, you night want to look into using the Response Screening Platform available in JMP.  It is designed to look at a large number of analyses and to attempt to make some sense to fact that false positives can impact an analysis.

txnelson_0-1695647369560.png

To do this, a simple transpose of your data from being row centric to a column centric shape is required(JMP typically uses column centric data structure).

The example below shows the transpose and the analysis

names default to here(1);

// Create an example data table 
dt = 
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

dtExample = dt << Subset( columns(:NPN1, :NPN2, :NPN3, :NPN4), output table( "Example" ) );

// Close the semiconductor capability data table
close( dt, nosave );

// Transpose into columns
dtTrans = dtExample << Transpose(
	columns( Column Group( "Processes" ) ),
	Output Table( "Transpose of Example" )
);

close( dtExample, nosave );

// New column: Primary
dtTrans << New Column( "Primary",
	Numeric,
	"Continuous",
	Format( "Best", 12 ),
	values([0,1,3,6])
) << Move Selected Columns( {:Primary}, To First );

// Build a JMP list to handle all of the transposed columns as 
// a single reference
responseColList = dtTrans << get column names(string, continuous );
// Delete the first entry which is the new column called Primary
remove from( responseColList, 1,1);

// Run the Response Screening Platform which is designed to allow for the 
// exploration of a large number of analyses
// Launch platform: Predictor Screening
dtTrans <<
response Screening(
	Y( eval(responseColList)
	),
	X( :Primary ),
	Show Slopes( 1 ),
	PValues Table on Launch( 0 ),
	Common Y Scale( 1 ),
	Common X Scale( 1 ),
);

Details on the Response Screening Platform can be found in the Help Screens, or in the Predictive and Specialized Modeling document, available in the JMP Documentation Library, under the Help pull down menu

Jim
Rober
Level I

Re: Fit a model between data set and the generated slope

Thanks for your effort, the main purpose of my sheet that I want to do Monte Carlo Simulation to make noiseness (400 psudo data set) to the first row with fixing the time points, the excel sheet that I shared with you consists of experimental one row and 399 generated data sets, what I'm trying to say if column centric would help to generate these data kindly advise me the way to do that. 

I have tried your first method and it works, but unfortunately I'm still new in JMP so now I learn JSL to understand how to make your method.

Thanks again

txnelson
Super User

Re: Fit a model between data set and the generated slope

There is detailed documentation on the Profiler, and the use of a Noise Factor in the Profilers documentation in the JMP Documentation Library, available under the Help pull down menu.

Maybe that will provide you with what you need.

Jim