Description Usage Arguments Details Value References Examples
Nonparametric kernel regression with automatic interactions among multiple predictors, adapted here for in-sample estimation AND out-of-sample prediction. Also known as 'generalized product kernel' regression in econometrics.
1 2 3 4 5 6 7 8 9 |
spe |
species dataframe, rows = sample units and columns = species |
idi |
in-sample predictor dataframe, rows must match 'spe' |
ido |
out-of-sample predictor dataframe, where rows = new sample units |
nm |
string vector specifying predictors to include (max 2) |
nmulti |
number of random starts in nonparametric regression |
pa |
logical, convert to presence/absence? |
pr |
logical, use 'beals' for probs of joint occurrence? |
... |
additional arguments passed to function |
obj |
object of class 'npmr' from call to |
pick |
variable to query |
zlim |
vector of length 2, giving vertical limits for plots |
NPMR is nonparametric multiplicative regression (McCune 2006). This
implementation uses a variant npreg
from package
'np', where it is known as generalized product kernel regression
(Li and Racine 2007). The current function is used in a predictive
capacity for estimating environmentally constrained fitted values
for NGNN, and therefore requires a predictor matrix for
out-of-sample observations.
Sensitivity analysis is available, following Eqn 9 in McCune (2006:825), aka Sensitivity Formula 1 in Hyperniche software. Sensitivity (Q) is the mean absolute difference in the response resulting from nudging the predictors +/- 5 proportion of the range of the response variable. Q = 1 means that nudging a predictor results in a change in response of equal magnitude, and Q = 0 means that nudging a predictor has no detectable effect on the response.
List of class 'npmr' with elements:
spe = original species matrix
id_i = in-sample predictors used in NPMR
nm = which predictors were used
nm_len = their length
iYhat = in-sample fitted values from NPMR
oYhat = out-of-sample fitted values from NPMR
np_stat = fit, tolerances and results of signif tests
np_mods = list of NPMR regression models for every species
np_bw = list of NPMR bandwidths for every species
Li, Q. and J. S. Racine. 2007. Nonparametric Econometrics: Theory and Practice, Princeton University Press.
McCune, B. 2006. Non-parametric habitat models with automatic interactions. Journal of Vegetation Science 17(6):819-830.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # set up
set.seed(978)
require(vegan)
data(varespec, varechem)
spe <- varespec ; id <- varechem
i <- sample(1:nrow(spe), size=floor(0.75*nrow(spe))) # sample
spe <- spe[i, ] # in-sample species
idi <- id[i, ] # in-sample predictors
ido <- id[-i, ] # out-of-sample predictors
nm <- c('Al', 'K') # select 1 or 2 gradients of interest
# NPMR basic usage
res_npmr <- npmr(spe, idi, ido, nm, nmulti=5)
summary(res_npmr)
# sensitivity analysis
Q <- npmr_sens(obj=res_npmr, pick = 'Vaccmyrt', nm)
Q
# plot NPMR species response curves
plot(res_npmr, pick=4, nm) # alternatively: pick='Vaccmyrt'
plot(res_npmr, pick=1:9, nm)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.