These are the web pages for the book "Regression with Linear Predictors" by Per Kragh Andersen and Lene Theil Skovgaard published 2010 by Springer-Verlag (ISBN 978-1-4419-7169-2, Springer official site).

Here you will find example programs for tables and figures in the book written in R, SAS and Stata. While the collection of R- and SAS-programs is fairly complete, programs in Stata are still being worked on and will be added to the pages successively once they are ready.

A couple of figures, involving no data analysis, are only documented in R. For tables involving no data analysis, no programs are shown.

Running the programs

The programs can be downloaded and used locally. Alternatively the programs can be executed directly from the homepage, as follows:

Running R programs

To run the R program for, e.g. Figure 1.3.7, type

source("http://staff.pubhealth.ku.dk/~linearpredictors/programs/Figure-1-3-7.R", print.eval = TRUE)

in the R prompt.

The option print.eval = TRUE ensures that results of commands get printed to the screen.

Alternatively, use "echo = TRUE" to print both commands and the result of their evaluation.

Running SAS programs

To run the SAS program for, e.g. Figure 1.3.7, one possibility is to include the program url in a local SAS-file by

FILENAME program URL 'http://staff.pubhealth.ku.dk/~linearpredictors/programs/Figure-1-3-7.sas';
%include program;

and then run the local file.

Graphical settings used in all programs generating graphical output can be seen here. These "goptions" include device specification, lay-out information, and macros for producing several plots in a single sheet. If changes in appearence are desired then personal goptions may be used instead, by modifying the first two lines of the program.

Running Stata programs

To run the Stata program for, e.g. Figure 1.3.7, type

do "http://staff.pubhealth.ku.dk/~linearpredictors/programs/Figure-1-3-7.do"

in the Command Window.

Graphical settings used in all programs generating graphical output can be seen here. This "scheme" includes lay-out specification but so far no command for producing several plots in a single sheet. If changes in appearence are desired then a personal scheme may be used instead, by modifying the relevant two lines of the program.