Surface Fitting to Biopharmaceutical Data

Curve Fitting Toolbox™ software provides some example data for an anesthesia drug interaction study. You can use Curve Fitting app to fit response surfaces to this data to analyze drug interaction effects. Response surface models provide a good method for understanding the pharmacodynamic interaction behavior of drug combinations.

This data is based on the results in this paper:

  • Kern SE, Xie G, White JL, Egan TD. Opioid-hypnotic synergy: A response surface analysis of propofol-remifentanil pharmacodynamic interaction in volunteers. Anesthesiology 2004; 100: 1373–81.

Anesthesia is typically at least a two-drug process, consisting of an opioid and a sedative hypnotic. This example uses Propofol and Reminfentanil as drug class prototypes. Their interaction is measured by four different measures of the analgesic and sedative response to the drug combination. Algometry, Tetany, Sedation, and Laryingoscopy comprise the four measures of surrogate drug effects at various concentration combinations of Propofol and Reminfentanil.

To interactively create response surfaces for this drug combination:

  1. Use the Current Folder browser to locate and view the folder matlab\toolbox\curvefit\curvefit.

  2. Right-click the file OpioidHypnoticSynergy.txt, and select Import Data. The Import Wizard appears.

    1. Leave the default Column delimiters set to Tab and Column vectors in the Import tab.

      Review the six variables selected for import: Propofol, Reminfentanil, Algometry, Tetany, Sedation, and Laryingoscopy.

    2. On the Import tab, in the Import section, click Import Selection to import the dose-response data into the MATLAB® workspace.

    Alternatively, you can import the data programmatically. Enter the following code to read the dose-response data from the file into the MATLAB workspace.

    data = importdata( 'OpioidHypnoticSynergy.txt' );
    Propofol      = data.data(:,1);
    Remifentanil  = data.data(:,2);
    Algometry     = data.data(:,3);
    Tetany        = data.data(:,4);
    Sedation      = data.data(:,5);
    Laryingoscopy = data.data(:,6);
    
  3. To create response surfaces you must select the two drugs for the X and Y inputs, and one of the four effects for the Z output. After you load the variables into your workspace, you can either open the tool and select variables interactively, or specify the initial fit variables with the cftool command.

    Enter the following to open Curve Fitting app (if necessary) and create a new response surface for Algometry:

    cftool(Propofol, Remifentanil, Algometry)

    Review the Curve Fitting app X, Y, and Z input and output controls. The tool displays the selected variables Propofol, Remifentanil and Algometry, with a surface fit. The default fit is an interpolating surface that passes through the data points.

  4. Create a copy of the current surface fit by either:

    1. Selecting Fit > Duplicate "Current Fit Name".

    2. Right-clicking a fit in the Table of Fits, and selecting Duplicate.

  5. Select the Custom Equation fit type from the drop-down list to define your own equation to fit the data.

  6. Select and delete the example custom equation text in the edit box.

    You can use the custom equation edit box to enter MATLAB code to define your model. The equation that defines the model must depend on the input variables x and y and a list of fixed parameters, estimable parameters, or both.

    The model from the paper is:

    E=Emax.(CAIC50A+CBIC50B+α.CAIC50A.CBIC50B)n1+(CAIC50A+CBIC50B+α.CAIC50A.CBIC50B)n

    where CA and CB are the drug concentrations, and IC50A, IC50B, alpha, and n are the coefficients to be estimated.

    You can define this in MATLAB code as

    Effect = Emax*( CA/IC50A + CB/IC50B + alpha*( CA/IC50A )...
             .* ( CB/IC50B ) ).^n ./(( CA/IC50A + CB/IC50B + ...
             alpha*( CA/IC50A ) .* ( CB/IC50B ) ).^n  + 1);

    Telling the tool which variables to fit and which parameters to estimate, requires rewriting the variable names CA and CB to x, and y. You must include x and y when you enter a custom equation in the edit box. Assume Emax = 1 because the effect output is normalized.

  7. Enter the following text in the custom equation edit box.

    ( x/IC50A + y/IC50B + alpha*( x/IC50A ) .* ( y/IC50B ) ).^n
      ./(( x/IC50A + y/IC50B + alpha*( x/IC50A ) .* 
      ( y/IC50B ) ).^n  + 1);

    Curve Fitting app fits a surface to the data using the custom equation model.

  8. Set some of the fit options by clicking Fit Options under your custom equation.

    In the Fit Options dialog box:

    1. Set Robust to Lar

    2. Set the alpha StartPoint to 1 and lower bound to –5.

    3. Leave the other defaults, and click Close.

      The tool refits with your new options.

  9. Review the Results pane. View (and, optionally, copy) any of these results:

    • The model equation

    • The values of the estimated coefficients

    • The goodness-of-fit statistics

  10. Display the residuals plot to check the distribution of points relative to the surface by clicking the toolbar button or selecting View > Residuals Plot.

  11. To generate code for all fits and plots in your Curve Fitting app session, select File > Generate Code.

    The Curve Fitting app generates code from your session and displays the file in the MATLAB Editor. The file includes all fits and plots in your current session.

  12. Save the file with the default name, createFits.m.

  13. You can recreate your fits and plots by calling the file from the command line (with your original data or new data as input arguments). In this case, your original data still appears in the workspace.

    Highlight the first line of the file (excluding the word function), and evaluate it by either right-clicking and selecting Evaluate Selection in Command Window, pressing F9, or copying and pasting the following to the command line:

    [fitresult, gof] = createFits(Propofol,...
     Remifentanil, Algometry)

    The function creates a figure window for each fit you had in your session. The custom fit figure shows both the surface and residuals plots that you created interactively in the Curve Fitting app.

  14. Create a new fit to the Tetany response instead of Algometry by entering:

    [fitresult, gof] = createFits(Propofol,...
     Remifentanil, Tetany)

    You need to edit the file if you want the new response label on the plots. You can use the generated code as a starting point to change the surface fits and plots to fit your needs. For a list of methods you can use, see sfit.

To see how to programmatically fit surfaces to the same example problem, see Surface Fitting With Custom Equations to Biopharmaceutical Data.