link | R Documentation |
This function links the bagged predictions to a tree object
link(x, object, LatID, LonID, plot = TRUE, oob = FALSE,
orderN = FALSE)
## S3 method for class 'bag'
link(x, object, LatID, LonID, plot = TRUE, oob = FALSE,
orderN = FALSE)
x |
object of class |
object |
tree object of class |
LatID |
column name for latitude. |
LonID |
column name for longitude. |
plot |
logical. Should a plot be produced. |
oob |
logical. Should out of bag (oob) predictions be used to map back to the terminal nodes of the tree. |
orderN |
logical. Should the node outputs be ordered. |
The direction of a zero-length arrow is indeterminate, and hence so
is the direction of the arrowheads. To allow for rounding error,
arrowheads are omitted (with a warning) on any arrow of length less
than 1/1000 inch. See arrows
for more details.
a list containing the following items:
m |
matrix of mean proportions |
v |
matrix of variances |
lci95 |
matrix of lower 95% confidence intervals |
uci95 |
matrix of upper 95% confidence intervals |
Kuhnert, P.M., Duffy, L. M and Olson, R.J. (2012) The Analysis of Predator Diet and Stable Isotope Data, Journal of Statistical Software, In Prep.
Kuhnert PM, Kinsey-Henderson A, Bartley R, Herr A (2010) Incorporating uncertainty in gully erosion calculations using the random forests modelling approach. Environmetrics 21:493-509. doi:10.1002/env.999
bagging
# Assigning prey colours for default palette
val <- apc(x = yftdiet, preyfile = PreyTaxonSort, check = TRUE)
node.colsY <- val$cols
dietPP <- val$x # updated diet matrix with Group assigned prey taxa codes
# Fitting the classification tree
yft.dp <- dpart(Group ~ Lat + Lon + Year + Quarter + SST + Length,
data = dietPP, weights = W, minsplit = 10,
cp = 0.001)
yft.pr <- prune(yft.dp, se = 1)
plot(yft.pr, node.cols = node.colsY)
# Bagging
# Bagging with NO spatial bootstrapping
#yft.bag <- bagging(Group ~ Lat + Lon + Year + Quarter + SST + Length,
# data = dietPP, weights = W, minsplit = 50,
# cp = 0.001, nBaggs = 500, predID = "TripSetPredNo")
# Link the predictions back to terminal nodes of a tree and plot
#ex.bag.l <- link(x = yft.bag, object = yft.pr, LatID = "Lat", LonID = "Lon",
# mapxlim = c(-125, -75), mapylim = c(0, 30), plot = TRUE, oob = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.