cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar

Help with Scripting to Compile Parameters from Curve Fit

I am in need of help editing a script originally developed to pull microbial growth parameters from a Logistic 4P model (Fit Curve Platform). I would like to edit the script to pull parameters from each treatment "strain, media, replicate", see desired output for what I would like. I am obviously missing some important language in the script but I am not clear how to do this. A scripting answer would be great! Please help!

 

This is the error I am getting:

 

"Subscript problem in access or evaluation of 'r[Outline Box(Parameter Estimates"),Number Col Box("Estimate",1)]', r]/*###*/Outline Box( "Parameter Estimates" ), Number Col Box( "Estimate", 1 )]

 

Script I would like to edit - "Extract Critical Values"

Script for desired output table - "Desired Output"

 

Extract Critical Values

Names Default To Here(1);

// Determine coefficients of Logistic 4P model, for estimation of growth parameters.

// This assumes that the current data table contains the data of interest, and that:
//   the column containing the time values is labeled "Time (h)"
//   the column containing the data values is labeled "Ln OD600"
//   the column containing “strain” and “media” and “replicate” are grouping columns
//
// The names can be changed in the lines below, 
// or the code can be changed to add a file dialog and a column selection,
// or the code can be changed to loop through multiple Y columns.


// First step:  Fit Logistic 4P curve to data, store results in object Test.

Test = Fit Curve(
	Y( :Ln OD600 ),
	X( :Name( "Time (h)" ) ),
	By( :Strain, :Media, :Replicate ),
	Fit Logistic 4P
);


// 2nd step:  Send report to variable r.

r = Test<<report;


// 3rd step:  Interrogate variable r to retrieve fit parameters from report table of estimates:

a = GrowthRate = r[outlinebox("Parameter Estimates"),NumberColBox("Estimate",1)] << get(1);
b = InflectionPoint = r[outlinebox("Parameter Estimates"),NumberColBox("Estimate",1)] << get(2);
c = LowerAsym = r[outlinebox("Parameter Estimates"),NumberColBox("Estimate",1)] << get(3);
d = UpperAsym = r[outlinebox("Parameter Estimates"),NumberColBox("Estimate",1)] << get(4);


// 4th step:  Find roots of 3rd derivative of Logistic 4P function (see word doc)
root1 = TimeOfLagPhase = (a*b + ln(2-sqrt(3)))/a;
root2 = TimeOfStationaryPhase = (a*b + ln(2+sqrt(3)))/a;

show(GrowthRate);
Show(InflectionPoint);
show(LowerAsym);
show(UpperAsym);
show(TimeOfLagPhase);
show(TimeOfStationaryPhase);


// Save in new data table
dt=New Table("summary stats",
	Add Rows(1),
	New Column ("Strain",Character,Nominal),
	New Column ("Media",Character,Nominal),
	New Column ("Replicate",Character,Nominal),
	New Column ("Growth Rate", Continuous),
	New Column ("Inflection Point", Continuous),
	New Column ("Lower Asymptote", Continuous),
	New Column ("Upper Asymptote", Continuous),
	New Column ("Time of Lag Phase", Continuous),
	New Column ("Time of Stationary Phase", Continuous)
);
:Growth Rate[1]=GrowthRate;
:Inflection Point[1]=InflectionPoint;
:Lower Asymptote[1]=LowerAsym;
:Upper Asymptote[1]=UpperAsym;
:Time of Lag Phase[1]=TimeOfLagPhase;
:Time of Stationary Phase[1]=TimeOfStationaryPhase;

 

3 REPLIES 3

Re: Help with Scripting to Compile Parameters from Curve Fit

I think that there is an unnecessary level of subscripting in the display tree that is causing the error. Here is an example of what I mean:

 

a = GrowthRate = r[outlinebox("Parameter Estimates"),NumberColBox("Estimate",1)] << get(1);

I think that removing the last level will avoid the error:

 

a = GrowthRate = r[outlinebox("Parameter Estimates"),NumberColBox("Estimate")] << get(1);

Re: Help with Scripting to Compile Parameters from Curve Fit

Hi @Mark_Bailey 

Thanks for the help but I am still getting the same error. I removed the last level or the "1" after "Estimate". Any other suggestions are welcome!

Re: Help with Scripting to Compile Parameters from Curve Fit

Here is an example of how I do it.

 

Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

fc = dt << Fit Curve(
	Y( :weight ),
	X( :height ),
	Fit Exponential 2P
);

fcr = fc << Report;

{ a, b } = fcr["Parameter Estimates"][NumberColBox("Estimate")] << Get;