An S-Plus function to calculate relative risks and adjusted means for regression models using natural splines

Comput Methods Programs Biomed. 2006 Oct;84(1):58-62. doi: 10.1016/j.cmpb.2006.08.004. Epub 2006 Sep 18.


We provide for generalized linear regression models that use natural cubic splines to model predictors an S-Plus function to calculate relative risks (RR), log relative risk (logRR), mean percent change (MPC) for continuous covariates modeled using a logarithmic link as well as adjusted means differences (MD) for the identity link. The function makes explicit use of the natural spline basis functions, the estimated coefficients for each natural spline basis function, and the fitted correlation matrix for the estimated coefficients and can thus accommodate any number of degrees of freedom. The main function produces a publication-quality graph of all of these quantities as compared to a user-specified reference value as well as the associated confidence limits. In another function, specific values of these statistics comparing a vector of values of the independent variable to the reference value can be calculated rather than plotted.

Publication types

  • Research Support, Non-U.S. Gov't

MeSH terms

  • Regression Analysis*
  • Risk