 / Home

# Statistical Modelling in S-Plus

A library of functions for S-Plus

This page links to source code and documentation for a variety of S-Plus functions for statistical modelling. You can download source code for each function from its help page (see the link 'download script' in the top-right of each page). All functions have been tested in S-Plus 2000 for Windows.

I (Gordon Smyth) am the author of all code below unless otherwise specified. All the code below is open source under LGPL license.

Note that I now use R rather than S-Plus for statistical programming. While I will respond to bug reports for the functions below, I have no plans to develop these functions further or to port them to later versions of S-Plus. See my R libraries for my current work.

## Data Analysis and Programming

Produce an added variable plot for each covariate in a linear model.
bessel.i0
Modified Bessel function of order 0.
clip.plot
Copy the current plot to the Windows clipboard as a metafile in S-Plus 3.3 or earlier.
choose
Binomial coefficients.
influence
Leverage, residuals and influence for a linear model, generalized linear model or generalized additive model.
Function minimization by the Nelder-Mead simplex algorithm. Implementation by Bill Clark and David Clifford.
nineplot
Normal probability plot surrounded by random plots for calibration.
plotcircles
Scatterplot with circle size indexing a third variable. A method of plotting three numeric variables simultaneously.
Truncated Poisson Distribution
Random number generation from the truncated Poisson distribution.
shared.r2
Shared R2 values for the columns of two dimensional array.
sym.plot
Symmetry plot of a sample of numbers.
dzeroc
Density of a distribution with specified cumulants.

## Generalized Linear Models

Inverse Gaussian Distribution
Density, distribution function and random deviates for the inverse Gaussian distribution.
Poisson Gamma Distribution
Density and distribution function for the Poisson gamma (or compound Poisson) distribution.
Polygamma Functions
The digamma and trigamma functions, first and second derivates of log(gamma(x)). Slightly edited from original functions written by Bill Venables.
pointwise.logit
Predicted values and confidence intervals for logistic regression.
qres
Randomized quantile residuals for generalized linear models.
reglm
Estimated a generalized linear model with random factors using the method of Schall (1991).
Tweedie Distributions
Density, cumulative distribution function and quantiles for the Tweedie distributions. Includes the normal, Poison, Poison-gamma and inverse-Gaussian distributions as special cases.
Tweedie Family
Specify a generalized linear model family with any power variance function and any power link. Includes the Gaussian, Poisson, gamma and inverse-Gaussian families as special cases.

## Double Generalized Linear Models

remlscore
REML estimation for a heteroscedastic linear regression model.
dglm
Double generalized linear models. Simultaneously model the mean and dispersion in generalized linear models.
Digamma Family
Specify a Digamma generalized linear model family. The Digamma distribution is the unit deviance distribution for the gamma family.
dglm.object
Describes the object produced by the dglm function.
tariff
Fit Tweedie's compound Poisson model to insurance claims data.

## Frequency Estimation

Matrix by Vector
Multiply the rows or columns of a matrix by the elements of a vector.
polycoef
Compute the coefficients of a polynomial given its roots.
polyval
Compute the value of a polynomial.
pronyfreq
Frequency estimation using an eigenanalysis based method. Does not require starting values.
lsfreq
Frequency estimation by separable least squares.

## Robust Estimation

mmnl
MM estimation of a nonlinear regression function.
mscale
M estimation of a scale parameter.
psi.hampel
Hampel's redescending psi function.
rho.hampel
The integral of Hampel's redescending psi function.
mmfreq
MM estimation of a sum of sinusoidal signals.
robfreq
Robust frequency estimation using a multistage algorithm.

## Extended Poisson Process Models for Count Data

Computes a saddlepoint approximation based on the negative binomial distribution for the probabilities in an extended Poisson process model.