Author |
Topic  |
|
supergrobi
Germany
1 Posts |
Posted - 02/18/2002 : 09:56:23 AM
|
Dear Madam, Dear Sir,
we would like to know, how to CALCULATE EC(x)-values after a succesfull non-linear curve fit in a biological contect; and we don't want to use the inaccurate ScreenReader, but perform it in a analytical or even numerical way. To be more precise: we have a sigmoidal dose-response dataset, plot with a scatterplot, then doing a curve-fit with Weibull2-model, and now we need the specific EC50, EC20, ...and so on values. Is there any way to do this (automatically)? Thank you very much for your effort! Many Greetings Frank |
|
rtoomey
USA
184 Posts |
Posted - 02/19/2002 : 5:10:47 PM
|
If you are interested in finding a specific X value given a specific Y value, the calculation would have to be done using an iterative numerical process in LabTalk. The script you create could then be placed in the After Fitting scripts page for that fitting function so that it executes every time you click the Done button in the fitter. If you need help, please contact your local technical support representative. Here's the contact information:
Additive GmbH Rohrwiesenstr. 2 D-61381 Friedrichsdorf/Ts Phone: 6172 5905 0 Fax: 6172 77613 E-mail: origin@additive-net.de Web: http://www.additive-net.de/software/origin/
Please note: A suggestion has been entered requesting this feature be added to the fitter interface on the Results Page. The operation would include the ability to find an X value given a Y value and vice versa. Although it is too late to implement this feature for Origin 7.0, we are hoping to get it into the software for a future version. If you would like to add your comments to this item, please respond to this post and refer to QA70-928.
It should also be noted that Origin 7.0 will have this ability on the Linear, Polynomial, and Sigmoidal Fit tools.
- rtoomey
|
 |
|
easwar
USA
1965 Posts |
Posted - 02/21/2002 : 2:11:06 PM
|
Hi Frank,
The script segment posted here will let you find x values corresponding to a specified y value from the fit line. This script will work with NLSF fit sessions, once you have performed iterations to get your final fit curve, but have not yet closed the NLSF fit session by clicking the done button.
The script takes your y value as input, and then searches the fit dataset, yfit, to find all intervals which contain the y value. Once an interval is found, the interval is bisected repeatedly, and the y value is computed for the mid x value of the new interval. This computed y value is compared to the specified y value, and the process is continued till the difference between the two is less than 0.001%. Please note that if you specify a y value that is outside of the yfit range, then no computation is performed.
The easiest way to run this script is to: 1> Edit the file custom.ogs in your Origin installation folder 2> Comment out the line "type -b $General.Userbutton;" in that file 3> Copy and paste the script to this file and save the file 4> Perform your NLSF fit, and once the fit has converged, click on the button on the Standard toolbar in Origin that looks like a flowchart. This will launch a dialog that accepts the y value and then the computation will be performed 5> Keep the Script window open (menu command: Window | Script Window); the output from the script goes to the script window
As Ryan pointed out, we are planning on integrating this into the NLSF in the future.
Easwar OriginLab.
P.S. Pasting the script to the Forum resulted in loss of all the indents in the code making it hard to read, but it still works!
// Script for finding x value from y value, for NLSF fit // // // get y value from user and report to script window getn "Enter y value" yy; %b = y value entered = $(yy); type %b;
// get name of x dataset %a = xof(yfit);
sum(yfit); if( (yy < sum.min) || (yy > sum.max) ) { type y value entered is out of range of fit line!; //break; } else { type Found the following x,y pair(s):; // if yy is a point in yfit, then just repoert the corresponding x value xfound = 0; for(ii = 1; ii <= sum.n; ii++) { if( yy == yfit[ii] ) { %b = At y= $(yy) , x= $(%a[ii]); type %b; xfound = 1; } } // yy is not a point in yfit, need to iterate for finding x value if(!xfound) { // loop thru yfit to find all intervals that contain yy for(ii = 1; ii < sum.n; ii++) { if( ( (yy - yfit[ii]) * (yy - yfit[ii + 1]) ) < 0) { // found interval, now iterate xlo = %a[ii]; xhi = %a[ii + 1]; // chop up interval up to 100 times, or till % change in y value is < 0.001% for(ij = 1; ij < 100; ij ++) { // compute y value at interval limits ylo = fit(xlo); yhi = fit(xhi); // find mid point of interval, compute y value xmid = (xlo + xhi) / 2.0; ymid = fit(xmid); // if % change compared to user's y value is below limit, quit pchange = 100 * abs( (yy - ymid) / yy ) ; if (pchange < 0.001) break; // change interval limit depending on ymid value if(ylo < yhi) { if (yy > ymid) xlo = xmid; else xhi = xmid; } else { if (yy > ymid) xhi = xmid; else xlo = xmid; } } // report xmid and ymid ymid = fit(xmid); %b = At x= $(xmid) , y= $(ymid); type %b; } } } } // add few line feeds to output type "-------------------------------------------------"; type " "; // end of script
Edited by - easwar on 02/21/2002 14:14:02 |
 |
|
|
Topic  |
|
|
|