predict.traitglm: Predictions from fourth corner model fits

View source: R/predict.traitglm.R

predict.traitglmR Documentation

Predictions from fourth corner model fits


Obtains a prediction from a fitted fourth corner model object.


## S3 method for class 'traitglm'
predict(object, newR=NULL, newQ=NULL, newL=NULL, type="response", ...)



a fitted object of class traitglm.


A new data frame of environmental variables. If omitted, the original matrix of environmental variables is used.


A new data frame of traits for each response taxon. If omitted, the original matrix of traits is used.


A new data frame of abundances (sites in rows, taxa in columns). This is only used if seeking predicted log-likelihoods. If omitted, the original abundances are used.


The type of prediction required. The default is predictions on the scale of the response variable, alternatives are "logL" for predictive log-likelihood, and "link" for linear predictors.


Further arguments passed to or from other methods.


If newR and newQ are omitted, then as usual, predictions are based on the data used for the fit. Note that two types of predictions are possible in principle: predicting at new sites (by specifying a new set of environmental variables only, as newR) and predicting for new taxa (by specifying a new set of traits only, as newQ). Unfortunately, only predicting at new sites has been implemented at the moment! An issue with predicting to new taxa is that a main effect is included in the model for each taxon (by default), and the intercept would be unknown for a new species.

If predictive log-likelihoods are desired, a new data frame of abundances newL would need to be specified, whose rows correspond to those of newR and whose columns correspond to rows of newQ.


A matrix of predictions, with sites in rows and taxa in columns.


David I. Warton <>


Brown AM, Warton DI, Andrew NR, Binns M, Cassis G and Gibb H (2014) The fourth corner solution - using species traits to better understand how species traits interact with their environment, Methods in Ecology and Evolution 5, 344-352.

See Also




# fit a fourth corner model using negative binomial regression via manyglm:
ft$fourth #print fourth corner terms

# predict to the first five sites
predict(ft, newR=antTraits$env[1:5,])

mvabund documentation built on March 18, 2022, 7:25 p.m.