Fits a linear model, taking into account phylogenetic non-independence between data points. The strength and type of the phylogenetic signal in the data matrix can also be accounted for by adjusting branch length transformations (lambda, delta and kappa). These transformations can also be optimised to find the maximum likelihood transformation given the data and the model.
pgls(formula, data, lambda = 1.0, kappa = 1.0, delta= 1.0, param.CI = 0.95,
control = list(fnscale=-1), bounds = NULL)
pgls.likelihood(optimPar, fixedPar, y, x, V, optim.output=TRUE, names.optim=NULL)
pgls.blenTransform(V, fixedPar)
The 'pgls' function returns an object of class pgls
containing the following:
"na.action" "param.CI"
The original call to the 'pgls' function
A summary of the fitted model containing:
The model formula supplied.
The comparative data object provided.
The name of the comparative data object.
The log likelihood of the response variable given the model.
The residual mean square variance in the model.
The residual sum of squares from the model.
The null mean square variance for the model.
The null sum of squares for the response.
The AIC score of the model
The AICc score of the model, correcting for the number of cases and parameters estimated
The number of rows of data used in fitting the model
The number of parameter estimates
The standard errors of the parameter estimates
The phylogenetic covariance matrix used in the model, with branch length transformations applied.
The predicted values
The non-phylogenetic residuals
The phylogenetic residuals
The design matrix of the model
The variables include in the model.
The response of the model.
The name of the response variable.
A named numeric vector of length three giving the branch length transformations used in the model.
A named logical vector of length three indicating which branch length values in 'param' are maximum likelihood estimates.
The bounds on branch length parameter estimates used in the model.
A named list of length three giving confidence intervals and the p values at the parameter bounds for optimised branch length transformations. Fixed parameters will have a NULL entry in this list.
A named vector identifying any rows of missing data excluded from the model.
A model formula
A 'comparative.data' object containing the covariance matrix and data to be used in the model.
A value for the lambda transformation.
A value for the kappa transformation.
A value for the delta transformation.
A p value used to calculate confidence intervals.
A list of control parameters for the optim function.
A list of bounds to use for branch length transformations (see Details).
A named vector of branch length parameters to be optimised to find the maximum likelihood value.
A named vector of fixed values for branch length parameters.
A column matrix of the model response.
The design matrix of the model.
A phylogenetic covariance matrix.
A logical value. If true then 'pgls.likelihood' returns only the likelihood value for use in the 'optim' function.
The name of a single parameter being optimised. This is only required for estimating parameter confidence intervals, where the function 'uniroot' strips names from vectors.
The model is fitted using a data frame reduced to complete row cases to eliminate missing values. In order to ensure that the models fitted using different subsets of the data are comparable, the whole data frame data
is reduced to complete cases. In the future, a scope argument may be provided to control this but at present the data frame should be reduced to only those variables used in the maximal model in order to avoid prevent redundant variables causing rows to be dropped unnecessarily.
Rob Freckleton; David Orme
This function fits a linear model controlling for the non-independence between cases resulting from phylogenetic structure in the data. The stucture of the phylogenetic signal can be controlled by altering the parameters lambda, delta and kappa (see the 'caper' vignette for details). The implementation of the method is currently as described in Freckleton et al (2002).
The branch length transformations can be optimised between bounds using maximum likelihood by setting the value for a transformation to 'ML'. The default bounds are: lambda = c(1e-6,1), kappa = c(1e-6,3) and delta=c(1e-6,3). These defaults may be overridden by passing a named list with new elements to the bounds argument - only the bounds to be changed need to be provided (e.g. bounds=list(lambda=c(0,3))).
The 'pgls.likelihood' and 'pgls.blenTransform' methods are not primarily intended to be called by users. The 'pgls.likelihood' function provides a general method to calculate the likelihood of a model, given the covariance matrix, response, design matrix and branch length parameters.
R. P. Freckleton, P. H. Harvey, and M. Pagel. Phylogenetic analysis and comparative data: A test and review of evidence. American Naturalist, 160:712-726, 2002.
pgls.profile
, anova.pgls
, summary.pgls
data(shorebird)
shorebird <- comparative.data(shorebird.tree, shorebird.data, Species, vcv=TRUE, vcv.dim=3)
mod1 <- pgls(log(Egg.Mass) ~ log(M.Mass) * log(F.Mass), shorebird, lambda='ML')
mod2 <- pgls(log(Egg.Mass) ~ log(M.Mass), data=shorebird, lambda='ML', delta='ML')
Run the code above in your browser using DataLab