# General Instructions # # email support - techsupport@pharmastatsci.com # feedback survey - Feedback link, please send your comments and suggestions # # This script documents general instructions for executing the examples posted # using S-Plus 2000 for Windows. The programs are written with S Version 3.4 # and NLME Version 3.3. # The datasets and functions required to run the examples are all included # with S-Plus 2000. # # The commands can be executed directly from the command line or from the Script # Window. Execution from the Script Window is recommended, with execution of one or # a few commands at a time, as opposed to running the entire script at once. # To execute a script from the Script Window, follow the steps below. # # 1) Open the Script in the Script Window using the File, Open commands from the drop-down menu # 2) With the Script Window active, highlight the command or section of code to execute # by holding down the 'shift' key and using the up and down arrow keys to select # the text # 3) Use the F10 key or select 'Script, Run' from the drop-down menu to execute the code # 4) Review the output in the Script Output Window for text or the graphsheet Window for plots # 5) Repeat for the next section of code # 6) You can use the 'Windows, Tile Vertical' to view multiple windows simultaneously # # Running the entire script at once is not recommended, in many cases there are several # models within one script and it will take several minutes to run. # # Please email techsupport@pharmastatsci.com if you have questions, problems, comments, or # suggestions. # # Simple examples # This script generates plots of Theophylline (example data frame Theoph), fits # the data to two nonlinear models using the nlme function (one model specifies # Ke, Ka, and Cl with random effects and another specifies just Ka and Cl with # random effects). The two models are compared using the anova() fucntion. # The individual coefficients are listed using the coef() function. trellis.device() plot(Theoph) plot(Theoph,outer=~1,inner=~Subject,aspect="fill") #fit the complete model - use the self-starting function #SSfol for initial estimates - save the model as an object #named fit fit <- nlme(conc ~ SSfol(Dose, Time, lKe, lKa, lCl), fixed = lKe + lKa + lCl ~ 1, random = lKe + lKa + lCl ~ 1, data=Theoph) plot(fit) plot(augPred(fit)) plot(ranef(fit)) fit fixef(fit) ranef(fit) coef(fit) summary(fit) #update the model fit and specify random effects for only Ka and Cl #name the model fit.fix.ke fit.fix.ke <- update(fit, random = lKa + lCl ~ 1) plot(fit.fix.ke) plot(augPred(fit.fix.ke)) plot(ranef(fit.fix.ke)) fit.fix.ke #compare the models anova(fit,fit.fix.ke)