npmr: NPMR, Nonparametric multiplicative regression

Description Usage Arguments Details Value References Examples

Description

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.

Usage

1
2
3
4
5
6
7
8
9
npmr(spe, idi, ido, nm, nmulti, pa, pr, ...)

npmr_sens(obj, pick, nm, ...)

## S3 method for class 'npmr'
summary(obj, ...)

## S3 method for class 'npmr'
plot(obj, pick = NULL, nm, zlim, ...)

Arguments

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 npmr

pick

variable to query

zlim

vector of length 2, giving vertical limits for plots

Details

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.

Value

List of class 'npmr' with elements:

References

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.

Examples

 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)

phytomosaic/ngnn documentation built on May 9, 2019, 5:57 a.m.