P4 User Defined Equations
P4 User Defined Equations
0
Step-by-Step Examples
Within the Classic equations and the Prism equation library are most of the curve-fit models that a biologist
needs. Yet occasionally you may want to customize. For example, you may (a) need an equation of a form not built
into Prism, (b) need to modify an existing equation, e.g., changing the two-site binding model to accommodate
three sites, or (c) simply wish to rename the parameters in a built-in equation so that the curve-fit results will be
labeled more appropriately.
In this example, we’ll enter and fit data to a “user-defined” equation of a form not preprogrammed into Prism. The
time course for total systemic absorption of a drug, expressed as the fraction (F) of the amount administered at a
subcutaneous depot at time 0, is given by2
1 e-ket/( ke ka ) -ket
F= -e
( ke ka ) - 1
where t = time (min), and ke and ka are the first-order elimination and absorption rate constants (min-1),
respectively. We’ll plot an example time course and fit the curve to the data to obtain an estimate of the rate
constants.
1Adapted from: Miller, J.R., GraphPad Prism Version 4.0 Step-by-Step Examples, GraphPad Software Inc., San
Diego CA, 2003. Step-by-Step Examples is one of four manuals included with Prism 4. All are available for
download as PDF files at www.graphpad.com. While the directions and figures match the Windows version of
Prism 4, all examples can be applied to Apple Macintosh systems with little adaptation. We encourage you to print
this article and read it at your computer, trying each step as you go. Before you start, use Prism’s View menu to
make sure that the Navigator and all optional toolbars are displayed on your computer.
2003 GraphPad Software, Inc. All rights reserved. GraphPad Prism is a registered trademark of GraphPad
Software, Inc. Use of the software is subject to the restrictions contained in the software license agreement.
2 Neubig, R. R., The Time Course of Drug Action, in Principles of Drug Action (W.B. Pratt and P. Taylor, eds.), 3rd
Edition, Churchill Livingtone Inc., 1990.
1
In the Welcome dialog, make the settings shown below.
For this example, we’re assuming that the Y values do not require correction by subtraction of a baseline—the
minimum Y value is already 0. If you wish to subtract a baseline value from each Y value in a data set, read about
automatic baseline correction in the Step-by-Step Example “Substrate-Velocity Curves and Lineweaver-Burk
Plots”.
Click the yellow Graphs tab on the toolbar to view the graph:
0.3
0.2
0.1
0.0
0 25 50 75 100 125 150
Time (min)
2
Entering the User-Defined Equation
With the graph displayed, click on the Analyze button. From the Curves & regression category, select
Nonlinear regression (curve fit).
In the Parameters: Nonlinear Regression (Curve Fit) dialog box (Equation tab), choose More
equations and, from the list below, click [Enter your own equation].
The User-defined Equation dialog is displayed. With the Equation tab selected, enter a Name for this curve-
fit analysis (which will be added to the More equations list the next time you view it). Now enter your equation,
in single-line form, into the Equation box. You are limited to certain types of equations and must adhere to a few
simple syntax rules. Your equation must be of the form
Y = f (x)
Thus, you must designate the dependent and independent variables as Y and X, respectively, and you must write
the equation so that Y is isolated on the left-hand side. The Prism User’s Guide lists all the rules for entering user-
defined equations in Prism, including the functions, or operators, that you may use. Our equation can be written
on a single line as follows (the equation is not reduced to simplest terms, but that will help illustrate the use of an
“intermediate” variable below):
Y=(exp(-Ke*X/(Ke/Ka))-exp(-Ke*X))/(Ke/Ka-1)
You can enter comments to prompt your memory or to help other users understand your equation by writing lines
beginning with a semicolon.
If you prefer, you can break an equation into two or more expressions to make the resulting system simpler or
more readable. Below, we define an intermediate variable
ratio = ke / ka
Prism will read that definition in the first line and then substitute ke/ka for “ratio” in the final equation:
3
Your user-defined equation may be a variation of one of Prism’s pre-programmed, or “classic”, equations. In that
case, you can keep manual entry of your equation to a minimum by copying the classic equation into the equation
box. In the Parameters: Nonlinear Regression (Curve Fit) dialog box, choose an equation from the Classic
equations list, then click the View Equation… button. In the Classic Equation dialog box, click Copy All to
place the contents of the Equation window on the clipboard. Now you can move to the User-defined
Equation dialog (from Parameters: Nonlinear Regression (Curve Fit), choose More
equations…[Enter your own equation]). Make sure the Equation tab is selected, then click Paste to enter
the classic equation into the Equation window. Now type your modifications.
If you can find a rule on this list that allows Prism consistently to derive an initial value from your data
(i.e., if the rule holds as your data varies within reason from experiment to experiment), this is the best
choice. You won’t have to enter a new initial value each time you run the curve-fit analysis.
4
Example
When collecting data for a sigmoidal dose-response curve, the input data are the logarithms of
drug concentrations tested, and investigators typically choose those concentrations such that
their logarithms will be distributed evenly over the curve. And the lower and upper plateaus of the
idealized curve can be approximated by the lowest and highest responses measured, respectively.
So good initial value rules for the for a three-parameter sigmoidal fit would be
BOTTOM: 1*YMIN
TOP: 1*YMAX
Generating a trial curve is not mandatory. If the initial values produce a trial curve very far away
from the data, Prism may not be able to figure out how to adjust the parameters for the next
iteration, and it may abort the process. But ordinarily, the initial values need only be rough
approximations of the fitted values, and it will not help to “fine-tune” them. If you are confident of
your initial value settings, just go on to the next section.
In the Parameters: Nonlinear Regression (Curve Fit) dialog box, choose to …Plot the curve defined by
the initial values.
5
Click OK to generate the curve with ke and ka fixed to the specified initial values. Here is a partial view of the
Results sheet.
Below is the graph (notations shown below were added using the text and drawing tools).
0.3
Fraction Absorbed
0.2
Trial simulation
0.1
ke = 0.05
ka = 0.02
0.0
0 30 60 90 120
Time (min)
Since the curve is reasonably close to the points, you’re ready to do the actual curve fit. Click the “Analysis
parameters” button.
6
Switch to the graph (notations in the figure below were added manually using the text and drawing tools).
0.3
Fitted curve
Fraction Absorbed
ke = 0.04381
0.2 ka = 0.02628
0.1
0.0
0 30 60 90 120
Time (min)
Constraining Parameters
You may place limits on the value that a parameter can take on in the course of curve fitting. From the User-
defined Equation dialog, select the Default Constraints tab. Prism displays the parameters for your
equation. In the Constraint and Value boxed next to the parameter to be constrained, set a “rule” for the
constraint. You may:
Fix (hold constant) a curve-fit parameter. Prism will substitute the specified value as if you had written it
directly into your equation, and it will fit only the remaining parameters. You may fix the value in the
Value box…
…or direct Prism to use, for each data set it fits, a value taken from the Y column heading on the table
holding that data set (for an illustration, seethe Step-by-Step Example “Computing Ki for a Competitive
Enzyme Inhibitor”).
7
For example, make these settings to preclude the possibility of fitting either ke or ka to a negative value
(physically unfeasible):
Stipulate that a parameter or parameters be shared, i.e., fitted to all data sets taken together.
For an example of shared parameters, see the Step-by-Step Example “Computing Ki for a Competitive
Enzyme Inhibitor”.
Require that a parameter value both be shared over multiple data sets and fall within a range.
Limit the value of one parameter relative to another fitted parameter. Specify, for example, that the value
of ke must be at least twice that of ka:
Setting constraints in the User-definded Equation dialog is only one of two ways to constrain parameters. It is
appropriate when you want the constraint to apply each time you use that particular model. You can also set and
change constraints for a particular nanalysis using the Constraints tab in the Parameters: Nonlinear
Regression (Curve Fit).