Description Usage Arguments Details Value Examples
Link abundances with environment
1 2 3 4 5 6 7 8 9 | relate_env(
y,
env,
n = 3,
tau = 0.75,
min.node.size = 5,
grid.resolution = 20,
...
)
|
y |
vector of the response variable: observed abundances/concentrations |
env |
data.frame or matrix of environmental variables associated with these observations |
n |
number of environmental variables to display, ordered in decreasing order of importance. |
tau |
quantile to predict. By default this is 0.75 in order to focus on the observations of large concentrations rather than on the mean; those observations are more relevant for HABs, where the most important cases are those featuring large abundances. |
min.node.size |
size of the nodes in the Random Forest trees. When this is large, this allows for more robust and smoother predictions; but making it too large just flattens the response curves. |
grid.resolution |
resolution of the grid for partial dependence plots. Making this larger gives more precise plots but is longer to compute. |
... |
passed to |
This function performs a quantile-based regression of the response variable on environmental variables using the Random Forest algorithm. Then it computes partial dependence plots depicting the univariate effect of the n
most relevant variables.
A ggplot2 plot, with one subplot per variable, ordered in decreasing order of importance (the percentage of "importance" is in the label of the subplot; this is the percentage of the part of the variance that the model explains which is attributable to that variable = sums to 100% for all variables, but that does not mean that the model explains 100% of the variance in the data of course).
1 2 3 4 5 6 7 8 9 10 11 12 13 | library("dplyr")
# correlate raw benthic concentrations with a few variables
relate_env(ost$benthic, env=select(ost, chla, temperature, poc), n=3)
# correlate only non-zero, transformed concentrations
ost_present <- filter(ost, benthic > 0)
conc <- sqrt(ost_present$benthic)
env <- select(ost_present, chla, temperature, poc)
relate_env(conc, env, n=3)
# make a finer, but also more noisy, model
relate_env(conc, env, n=3, min.node.size=1, grid.resolution=50)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.