splineGradient: Does post-processing of canonical analysis object from vegan...

Description Usage Arguments Value Examples

View source: R/SplineCAP.R

Description

Does post-processing of canonical analysis object from vegan to extract spline gradients

Usage

1
splineGradient(object, Bdf, Gnames = NULL, predB = NULL, plot = T, ...)

Arguments

object

The fitted rda/cca or capscale object

Bdf

Integer vector giving the degrees of freedom (number of columns) of the bases used.

Gnames

Gradient names corresponding to the bases.

predB

List containing the new set of bases for prediction.

plot

Draw plot of the gradient. predB must be supplied.

...

Arguments to be passed on to the plot command.

Value

Gradt Fitted gradient values

Env.scores Correlation scores for spline and linear covariates, for adding to a biplot

pred.Gradt List containing the fitted gradient values for predB

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(PitTraps)
Locn=PitTraps$Locn
distance=PitTraps$distance
Counts=PitTraps[,-c(1,2)]
B=bSpline(distance,degree=2,df=5)   #Spline basis for distance
Bpred=predict(B,newx=min(distance):max(distance)) #For prediction
CAP.fit=capscale((Counts>0)~B+Locn,dist="bray") #Fit RDA on PCOs
Gradients=splineGradient(CAP.fit,Bdf=5,predB=list(Bpred),type="l")

#Draw triplot
env=Gradients$Env.scores
ordiplot(CAP.fit,display = c("sp", "wa", "cn")[1:2],scaling=3,
            cex=0.6,xlim=c(-1.5,1.5),ylim=c(-1.5,1.5))
arrows(0,0,env[1,],env[2,],length=0.05,col="blue",lwd=1.5)
text(env[1,],env[2,],colnames(env),cex=0.8,adj=c(0,0.5))

rbmillar/SplineCAP documentation built on Feb. 20, 2021, 6:40 a.m.