Fit a floating trend to a factor in generalized linear model


Fits a "floating trend" model to the given factor in a glm in a generalized linear model by centering covariates.


ftrend(object, ...)



fitted lm or glm object. The model must not have an intercept term


arguments to the nlm function


ftrend() calculates "floating trend" estimates for factors in generalized linear models. This is an alternative to treatment contrasts suggested by Greenland et al. (1999). If a regression model is fitted with no intercept term, then contrasts are not used for the first factor in the model. Instead, there is one parameter for each level of this factor. However, the interpretation of these parameters, and their variance-covariance matrix, depends on the numerical coding used for the covariates. If an arbitrary constant is added to the covariate values, then the variance matrix is changed.

The ftrend() function takes the fitted model and works out an optimal constant to add to the covariate values so that the covariance matrix is approximately diagonal. The parameter estimates can then be treated as approximately independent, thus simplifying their presentation. This is particularly useful for graphical display of dose-response relationships (hence the name).

Greenland et al. (1999) originally suggested centring the covariates so that their weighted mean, using the fitted weights from the model, is zero. This heuristic criterion is improved upon by ftrend() which uses the same minimum information divergence criterion as used by Plummer (2003) for floating variance calculations. ftrend() calls nlm() to do the minimization and will pass optional arguments to control it.


A list with the following components


coefficients for model with adjusted covariates.


Variance-covariance matrix of adjusted coefficients.


The "floating trend" method is an alternative to the "floating absolute risk" method, which is implemented in the function float().


Martyn Plummer


Greenland S, Michels KB, Robins JM, Poole C and Willet WC (1999) Presenting statistical uncertainty in trends and dose-response relations, American Journal of Epidemiology, 149, 1077-1086.

See Also


Questions? Problems? Suggestions? or email at

All documentation is copyright its authors; we didn't write any of that.