Skip navigation
About Us Contact Us Software Support

Q: How can I analyze an algebraic model in the Compartmental application?

A: Although the Compartmental application is designed for complex compartmental models, it can handle algebraic models as well. They must, however, be constructed within the experimental framework used in the Compartmental application.

A simple example is to construct the model for a straight line and fit it to data.  Follow these steps:

  1. Start the Compartmental application.
  2. Click Experiment Attributes… on the Set menu. In the Experiment Attributes box, enter x for the Independent Variable name and 10.0 for the End At value.  Click the Done button to close the box.
  3. An experiment must be created in order to use the computational machinery in the Compartmental application. Click the Experiment button in the Toolbox.  Use the default values in the Create Experiment box (rename the experiment if desired), and click the Create button.
  4. A sample object is the link between the function that will be defined and the data to which it will be fitted.  To create a sample, click on the Sample tool in the Toolbox, and then click anywhere in the main model (white) window. The sample should appear as a red circle labeled s1 as shown in Figure 1.

    location of sample too in toolbox

    Figure 1
  5. Double-click on the sample object to open the Sample Attributes box. The name for the data could be entered in the Associate with Data Name area now, but for this example, it will be done after the data has been typed in.  Click in the Equations area, enter the equation shown below and then click the Done button.

    s1 = m * x + b
  6. Open the Data window by clicking Data on the Show menu.  Type in the data as shown in Figure 2. To check that the format is satisfactory, click Check Data Format on the Edit menu. If a mistake has been made an error message will appear; otherwise a Data Format is okay message will appear at the bottom of the Data window. Click the X in the upper right corner of the Data window to close it (or click Close on the File menu).

    data window

    Figure 2
  7. To inform the application that the data labeled s1_data is to be associated with the sample s1, click Associations on the Show menu to open the Associate Samples and Data dialog box. In the box, s1 (in the left pane) and s1_data (in the right pane) should already be highlighted. Click the Associate button. The entry in the left pane will change to s1 : s1_data to indicate that the sample and data are now associated. Click the Done button to close the box. Notice that the sample object is now solid red, which indicates that s1 is now associated with data.
  8. Before the model can be fitted to the data, approximate values are required for the parameters. Open the Parameter window by clicking Parameters on the Show menu, or by clicking the Parameters toolbar button. Notice that m and b are listed as parameters. Parameters are defined as any undefined variables in the model, i.e. they appear only on the right of the equal sign in one or more equations.  In this case, m and b appear in the equation for s1. Approximate values and upper and lower limits are required for each parameter to constrain the n-dimensional space (n = 2 here) that the optimizer must search for the values that minimize the objective function, i.e. create the best fit of the model to the data. Since the y-intercept, b, is already highlighted, enter 0.0 for the Value, -1.0 for the Low Limit, 1.0 for the High Limit, and then click the Save button. Next, double-click the line in the list containing m to place it into the edit area at the bottom of the box. Enter 1.0 for the Value and click the Save button. Notice that default values are supplied for the upper and lower limits. Click the Done button to close the box.
  9. All information required to fit the model to the data has now been entered. Click Fit on the Compute menu, or click the Fit toolbar button (looks like blue bar graph).
  10. Reopen the Parameter window.  Notice that the values for both m and b have been adjusted to provide the best fit of the model to the data. Close the Parameter window.
  11. To view a plot of the fitted line, click Plot on the Show menu, or click the Plot toolbar button (looks like a small plot).  In the left pane, select the s1 : s1_data entry, and click the Done button You should see the plot in Figure 3.

    resulting plot

    Figure 3
  12. When finished, close the Plot box, save the model (if desired), and exit the Compartmental Application.

<< Back to Support Page