
    EZ-Fit_UDF ''SOFTWARE'' User License Agreement 

    By installing, copying, or using the SOFTWARE, you agree to be 
    bound by the terms of this Agreement. If you do not agree to the 
    terms of this Agreement uninstall, do not activate, and delete   
    this SOFTWARE or return the SOFTWARE media and any accompanying  
    items to where you obtained them within sixty (60) days of the 
    the purchase date.  

    EZ-Fit_UDF - Nonlinear Regression Curve-Fitting 
    EZ-Fit_UDF Copyright  2025
    All Rights Reserved. 

1. This is an agreement between Licensor (software owner) and Licensee, who is being licensed to use the named SOFTWARE.

2. A "Licensee" is defined as one user and keyboard which is connected to a computer on which the software is installed. You may make one copy of any version of EZ-Fit for normal backup purposes. You may NOT distribute EZ-Fit. Specifically, you may not place EZ-Fit or any part of the software package in a commercial library, on a computer network, or distribute it with any other product or as an incentive to purchase any other product.

3. Licensee acknowledges that this is only a limited nonexclusive license. Licensor is and remains the owner of all titles, rights, and interests in the SOFTWARE.

4. The SOFTWARE may not be redistributed in any form except by the Licensor. Distributing any single component of the SOFTWARE is prohibited.

5. This License permits Licensee to install and use one copy of the SOFTWARE on one computer system. Licensee will not make copies of the SOFTWARE or allow copies of the SOFTWARE to be made by others, except for making one archival ''back-up'' copy of the SOFTWARE.

6. Licensee agrees to defend and indemnify Licensor and hold Licensor harmless from all claims, losses, damages, complaints, or expenses connected with or resulting from Licensees use of the SOFTWARE.

7. Licensee may not reverse engineer, decompile, or disassemble the SOFTWARE, nor attempt in any other manner to obtain the source code. The SOFTWARE is licensed as a single product. Its component parts may not be separated for use on more than one computer, nor otherwise used separately from the other parts.

8. Licensor has the right to terminate this License Agreement and Licensee's right to use this SOFTWARE upon any material breach by the Licensee.

9. This License Agreement is valid without Licensors signature. It becomes effective upon the earlier of Licensees signature or Licensees use of the SOFTWARE.

Disclaimer: The SOFTWARE is licensed to you ''AS IS'' and ''WITH ALL FAULTS.'' Licensee assumes the ENTIRE risk of all use of the SOFTWARE. No claim or warranty of any kind is made with respect to the fitness or accuracy of this SOFTWARE for a specific application. Should the program prove defective, Licensee assumes the cost of all necessary repair, correction, and liability for damages. Licensor is not liable to Licensee for any damages, including compensatory, special, incidental, exemplary, punitive, or consequential damages, connected with or resulting from this License Agreement or Licensee's use of this SOFTWARE.

Further, we do not warrant that the software function properly, will meet the users requirements, or that the operation of the program will be uninterrupted or free of error. Should the program prove defective, you (Licensee.) assume the entire cost of all necessary repair, servicing, or correction. In no event will Licensor be liable to you for any damages, including any lost profits, lost savings, or other incidental or consequential damages arising out of the use or inability to use these programs. You acknowledge that you have read this agreement, understand it, and agree to be bound by its terms and conditions. You further agree that it is the complete and exclusive statement of the agreement between us, which supersedes any proposal or prior agreement, oral or written, and any other communications between us.

    EZ-Fit_UDF ''SOFTWARE'' Overview:

EZ-Fit_UDF uses nonlinear regression to curve-fit data to the chosen 
model. The program adjusts the model parameters so that the model 
curve comes as close as possible to the data points. When no further 
improvement in the fit can be made, the program stops and reports 
the results of the analysis. Inspection of residual plots is useful to 
identify systematic deviations of data points from the fitted curve. 
When deviations or trends are observed, it may suggest that the model 
is inappropriate. The program uses a Model-Selection-Criterion (MIC) 
which is a modification of the Akaike Information Criterion (AIC test. 
The smaller the MIC value, including negative values, the better the 
fitted curve to the data points. The program calculates the  approximate 
standard errors of each fitted parameter of the chosen model. These 
values should generally not exceed a 20% coefficient of variation 
[100 x (SE/parameter) < 20%] when the chosen model is a good fit to 
the data. Parameter values are generally significant when their 
p-value is less than 0.05 and the eigenvalues are greater than 
1.E-05. A very large percent principal component can also indicate 
parameter redundancy. It is also useful, when fitting functions 
that are nonlinear in the parameters, to know the degree to which 
parameters are correlated with each other. Strong correlations 
can occur when data are fit to a function containing too many  
parameters, resulting in an over-determined curve-fit. In this 
case it may be useful to know which parameters should be  
considered for removal or masking from the model. Since nonlinear 
least squares models can have objective functions with multiple 
local minima, curve-fitting algorithms may occasionally converge to  
local minima depending upon the values of the initial parameter 
guess, the data noise, and model parameters. 

The program adjusts the model parameters so that the model 
curve comes as close as possible to the data points. 
The original X,Y data is compared with the best-fit calculated (Ycalc) 
data of the model function and expressed as adjusted Studentized 
residuals which are used for the detection of outlying data points. 
Outliers are candidates for aberrant data or ones that appear to 
deviate markedly from other data that may adversely lead to model 
misclassification, biased parameter estimation and incorrect results. 
It is therefore important to identify outliers prior to determining 
the best-fit model. The detection of outliers relies on the 
distribution of residuals which is assumed to be normally distributed. 
Studentized residuals are used as a replacement for the ordinary 
residuals in this analysis. The tau criterion is used to identify 
outliers (rejection of residuals) through the analysis of adjusted 
Studentized residuals and flag them for rejection: 

Residuals/(RMS*Sqrt(1-vii))/StdDevRes| > tau criterion 
This method takes into account a data sets standard deviation, 
and provides a statistically determined rejection limit, providing 
an objective method to determine if a data point is an outlier. 
The value of the Thompson tau is calculated from the critical value 
of the Students t PDF, and is a function of the number of data points 
in the sample. The tau is the critical Students t-value, based on 
alpha = 0.05 and degrees of freedom df = n-p where t is calculated 
for alpha/2 as Tinv(alpha,df). 

Nonlinear regression analysis is one way to evaluate models 
by curve-fitting data and determining which model best fits the 
data. Nonlinear regression is an iterative process of adjusting 
the given parameters until the chosen model best fits the data. 
The model that produces the smallest normalized Akaike Information 
Criterion value provides an indication of the goodness-of-fit.
Model functions are defined by the user of the software by 
creating User-defined (UDF) equations for curve-fitting. A UDF
can have up to 8 parameters and 3 independent X1..X3 variables. 

Some criteria used to distinguish among models:

o A model for which the regression converges but fails to converge for another model, should be accepted over the later model.

o A model for which the parameter values produced by the curve-fit give small standard errors, should be accepted over a model that produces very large standard errors of parameter values.

o Models which produce residuals deviations (difference between fitted curve and experimental data) that are relatively small, should be accepted over a model that produces large nonrandom deviations from the fitted curve.

o Models which produce the smallest Model Information Criterion (MIC) values should be accepted over a model that produce much larger MIC values.

o Models that produce parameter values with standard errors greater than 25%, even if the model may be correct, may have too large a variability of the velocity measurements. Increasing the number of data points may increase the precision of the velocity measurements.

o The distribution of X values should be broad enough to span both below and above the mid-point value.

o When an individual data point is inconsistent with the pattern of the majority of points, such an aberrant point may be considered an outlier. At times, outliers can have a large effect on the parameters and their standard errors. One way of eliminating outliers is to reject them when they are at least two or three standard deviations from the best fitted curve.

o Y value measurement errors that arise from experimental protocol or poor technique, pipetting errors, poorly calibrated equipment, or by day to day variability should be reduced as much as is practical or if possible eliminated.

o Why the Curve-Fit May Not Converge?
In some cases the curve-fit procedure may fail to find the optimal parameters values. The actual mathematical reason for this error might be the failure to invert the matrix calculated from partial derivatives of the fit function with respect to fit parameters. This inverted matrix is used to compute the new values of parameters for next step of the curve-fit. In most cases this error occurs when the matrix is ill-conditioned or nearly singular and the inverse cannot be calculated accurately enough using floating-point arithmetic. A possible cause of this error could be that some parameters are taking unrealistically values during curve-fit iterations or that there is no local minimum of residual sum of squares near the initial values of these parameters.  Another cause might be that there exists a mutual dependency between some parameters such that the algorithm could not resolve which parameter to vary. Alternatively, an unrealistic parameter value may cause a numeric overflow or underflow when calculating the fit function. When convergence is not successful try the following,

(1) select the "Rerun" option from the main menu,
(2) enter more accurate initial values of parameters, or
(3) mask some parameters to constrain them to a fixed value.

    EZ-Fit_UDF Quick Start:
    Steps to run the analysis: 
    1. Create an external text data file containing:  
    1.1 1st line: User-defined function 
    1.2 2nd line: Parameter values 
    1.3 3rd line: Lower bounds of parameter values 
    1.4 4th line: Upper bounds of parameter values 
    1.5 5th line: TRUE or FALSE mask of parameter (Fixed=FALSE) 
    1.5.1 Masks can be FALSE, F, false, f, or .FALSE. 
    1.6 6th line: X,Y data in columns 
    1.7 7th line: Word END is entered after the last data row 
    2. The delimiters for data file values are a space or comma. 
    3. UDF parameters (P1..P8) must be in sequence (Do not skip one) 
    4. Independent variables (X1..X3) must also be in sequence 
    4.1 UDF(X1,X3, P1,P2) or UDF(X1, P1,P2,P4) is NOT allowed
    4.2 UDF(X1,X2, P1,P2) or UDF(X1, P1,P2,P3) is allowed  
    5. Options: For hard to fit models choose DIFFICULT (default=EASY) 
    6. Options: For weighting of data: Reweight, 1/y^2, Robust weight 
    7. Select RUN to execute curve-fitting of the selected data file. 
    8. Scroll down to review the results of the curve-fit. 
    9. Select Display Results to review results. 
    10. Select Plot to display the plotted data. 


    EZ-Fit_UDF Functions and Operators:

    MATHEMATICAL: +, -, *, /, ^ or **

    LOGICAL: 
    equal, =                     (P1=P2) 
    not equal, #                 (P1#P2) 
    less than, <                 (P1<P2) 
    greater than, >              (P1>P2) 
    less than or equal to, [     (P1[P2) 
    greater than or equal to, ]  (P1]P2)

    MAXIMUM/MINIMUM VALUE: 
    minimum(a,b), :              (P1:P2) 
    maximum(a,b), !              (P1!P2)

    FUNCTIONS: 
    ABS(), EXP(), LOG10(), LOG(), SQRT(), SIN(), COS(), TAN(), 
    ASIN(), ACOS(), ATAN(), SINH(), COSH(), TANH(), OMEGW()


    Example #1 input data file format: Michaelis-Menten.dat
    Data file format:  
    The first line of the data file always contains the model function.  
    The model contains two adjustable parameters (P1 and P2).  
    The lower and upper parameter limits are set to 1.E-06 and 1.E+06, respectively.  
    None of the parameter values are held constant (mask = .TRUE.).  
    There is only one curve listed in columns as  X1  Y  values.  
    The one independent variable (X1) is listed first followed by the Y values   
    to fit. The last line of the data file must contain the word  END  to finish. 

    y = P2*X1/(P1 + X1) !<-- User-defined model 
    10.        100.     !<-- Initial parameter values 
    1.E-06     1.E-06   !<-- Lower limits of parameters 
    1.E+06     1.E+06   !<-- Upper limits of parameters 
    TRUE     TRUE       !<-- Masked parameters = FALSE 
    5      3.2     	!<-- Curve #1 
    10     15.9     	!<-- Data in columns: X1, Y
    15     35.8     
    20     45.1    
    25     69.1     
    30     75.6    
    35     76.6    
    40     83.7    
    45     80.5    
    50     90.0    
    55     87.2    
    60     94.3    
    65     99.0    
    70     90.7    
    75     88.6    
    80     97.0    
    85    101.9    
    90     90.8    
    95     90.5    
    100    105.0    
    END     !<-- Enter END TO EXIT 


    Example #2 input data file format for Noncompetitive Inhibition, 
    where X1=[S], X2=[I]
    y=Vmax/((1.0 + Km/X1)*(1.0 + X2/Ki))
    y=P2 / ((1.0 + P1 / X1) * (1.0 + X2 / P3))

    Data file format:  
    The first line of the data file always contains the User-defined model.  
    The model contains three adjustable parameters (P1, P2 and P3).  
    The lower and upper parameter limits are set to 1.E-06 and 1.E+06, respectively.  
    None of the parameter values are held constant (mask = .TRUE.).  
    There are four curves listed in columns as  X1, X2, and  Y  values.  
    The two independent variables (X1 and X2) are listed first followed by the Y values   
    to fit. The last line of the data file must contain the word  END  to finish. 


    y=P2 / ((1.0 + P1 / X1) * (1.0 + X2 / P3)) 	!<-- User-defined model 
    1.		1.	1.	!<-- Initial parameter extimates 
    1.E-06	1.E-06	1.E-06	!<-- Lower limits of parameters 
    1.E06	1.E06	1.E06	!<-- Upper limits of parameters 
    TRUE	TRUE	TRUE	!<-- UnMasked parameters = .TRUE. or TRUE for T 
    50		0	0.032	!<-- Data in columns: X1, X2, and Y of Curve #1
    100		0	0.055
    200		0	0.080
    250		0	0.090
    333		0	0.102
    500		0	0.116
    700		0	0.130
    50		100	0.017	!<-- Curve #2 (X2)
    100		100	0.028
    200		100	0.045
    250		100	0.050
    333		100	0.065
    500		100	0.072
    700		100	0.078
    50		200	0.010	!<-- Curve #3 (X2)
    100		200	0.018
    200		200	0.030
    250		200	0.036
    333		200	0.041
    500		200	0.048
    700		200	0.052
    50		350	0.006	!<-- Curve #4 (X2)
    100		350	0.012
    200		350	0.019
    250		350	0.023
    333		350	0.027
    500		350	0.030
    700		350	0.035
    END		!<-- Enter END TO EXIT 

