Logistic regression modeling in Phoenix

The data in this dataset were simulated to demonstrate logistic modeling. Eight subjects were simu­lated. Within each subject, the response was randomly generated as either zero or one with probabil­ity p, where ln(p/(1 – p))=a+bX+eta as X varies between one and 12.

Note:The completed project (Logistic_Model.phxproj) is available for reference in …\Exam­ples\NLME.

Set up the Maximum Likelihood Models object

  1. Create a new project called Logistic Model.

  2. Import the dataset …\Examples\NLME\Supporting files\logistic.dat.
    Click Finish in the File Import Wizard dialog.

  3. Right-click the worksheet and select Send To > Modeling > Maximum Likelihood Models.

  4. In the Structure tab of the ML Model object, select Linear from the Type menu.

  5. In the Linear menu, select E = Alpha + Beta*C.

  6. Select the Parameters > Structural sub-tab.

  7. Clear the Ran checkbox beside Beta to remove random effects from the Beta parameter.

Map the model variables

  1. Select the option buttons in the Main Mappings panel to map the data types as follows:
    ID to the ID context.
    rep to the C context.
    response to the EObs context.

Change the built-in model to a text model

  1. Click Edit as Textual.

  2. In the confirmation dialog, click Yes.

  3. Select Model in the Setup list.

The model text is displayed in the Model text panel as follows:

    test(){
         covariate(C)
         E = Alpha + Beta*C
         error(EEps = 1)
         observe(EObs(C) = E + EEps)
         stparm(Alpha = tvAlpha * exp(nAlpha))
         stparm(Beta = tvBeta)
         fixef(tvAlpha = c(, 1, ))
         fixef(tvBeta = c(, 1, ))
         ranef(diag(nAlpha) = c(1))
     }

Edit the text model

The model text needs to be edited to update the error and observation statements.

Note:Users can either type in the Model panel to edit the model text or copy and paste the lines of code from this example.

  1. Change the error statement to a probability statement:
              error(EEps = 1) 
    to
              prob = exp(E)/(1 + exp(E)) 

  2. Change the observation statement to a log likelihood statement:
              observe(EObs(C) = E + EEps) 
    to
              LL(EObs, EObs == 1 ? log(prob):log(1 - prob)) 

  3. Click icon_execute_18.png (Execute icon) to execute the object.

Use the multi statement

Edit the model text to use the multi statement, rather than the LL statement, for the multinomial response. The multi statement can be used for multinomial responses from two to ten ordered cate­gories, and allows use of a variety of link functions in addition to the ilogit function (inverse logit).

  1. Right-click ML Model in the workflow and select Copy.

  2. Right-click the Workflow object and select Paste.

  3. Rename the model copy as ML Model_multi.

  4. In the Model text panel, change the two statements
              prob=exp(E)/(1 + exp(E)) 
    and
              LL(EObs, EObs == 1 ? log(prob):log(1 - prob)) 
    to one statement
              multi(EObs, ilogit, E) 

  5. Execute the object.

Save and close the project

  1. Select File > Save Project.

  2. Click Save.

  3. Select File > Close Project.

  4. The project is saved and closed and Phoenix can be safely exited.

  5. This concludes the logistic regression modeling example.


Last modified date:7/9/20
Certara USA, Inc.
Legal Notice | Contact Certara
© 2020 Certara USA, Inc. All rights reserved.