dist_weight: Fit a distance-weighted model of landscape effects on an...

View source: R/dist_weight.R

dist_weightR Documentation

Fit a distance-weighted model of landscape effects on an environmental response

Description

dist_weight fits a specified model containing local and landscape variables.

Usage

dist_weight(
  mod0,
  landscape.vars,
  landscape.formula,
  data = NULL,
  weight.fn = "Gaussian",
  plot.fits = TRUE,
  lower = NULL,
  upper = NULL,
  init.range = NULL,
  n.partition = 10,
  opt.range = NULL,
  optim.method = "L-BFGS-B"
)

Arguments

mod0

a "local" model object, without landscape variables.

landscape.vars

list of names landscape matrices (one for each landscape variable).

landscape.formula

formula containing the landscape predictors.

data

a data frame with local predictors and response variables, where each row as a site sorted in the same order as the original site data frame.

weight.fn

the type of weighting function to use; "Gaussian" (default) or "exponential".

plot.fits

specify whether to produce plots (default = TRUE).

lower

lower bound on the variables for the "L-BFGS-B" method. See optim.

upper

upper bound on the variables for the "L-BFGS-B" method. See optim.

init.range

starting point distance for fitting the range parameter.

n.partition

number of partitions to divide the log-likelihood profile, in order to avoid identifying false maxima.

opt.range

specified value range parameter value. If specified, dist_weight. will fit the model using that value as the value of the range parameter rather than using. optim to identify the value that maximizes the log likelihood.

optim.method

specify method for optimization (default = "L-BFGS-B"). See optim.

Details

dist_weight fits the model using the function optim (method L-BFGS-B) to find the values of the model parameters that maximize the log-likelihood of the model fit to the data. It can be run with many types of regression models in R: lm and glm in base R, lmer and glmer in lme4, and lme and gls in nlme. It adopts the model syntax of the specified regression model,making it easy to use models of any type.Although dist_weight producesp-values for the regression coefficients (given by the underlying lm,glm, lmer, glmer, lme, or gls functions,these p-values are conditional on the estimate of the range parameter, and consequently they will likely have inflated type I error rates. The dist_weight_bootfunction uses a bootstrap likelihood ratio test to generate a single p-value for the landscape predictor variable(s) in the model. By bootstrapping, it accounts for the co-dependence of regression coefficient and range parameter. Therefore, p-values reported for landscape predictor(s) should come from dist_weight_boot rather than dist_weight.

Value

dist_weight returns an object of class scalescape. This is a list containing the following:

  • opt.range the estimate of the range value

  • logLik the maximum likelihood value

  • AIC AIC value for model fit

  • BIC BIC value for model fit

  • npar the number of model parameters

  • data the original (local) data frame used to fit the model

  • coef the coefficient of the landscape variable(s)

  • mod the landscape model, with distance-weighted landscape effect

  • mod0 the local model, without landscape effects

  • landscape.formula the formula specified to fit the landscape model

  • data.with.landscape a data frame that contains the original local variable and distance-weighted landscape variable(s)

  • landscape.vars the list of landscape matrices for each landscape variable

  • weight.fn the specified weighting function

  • max.Dist the specified maximum distance


benjaminiuliano/scalescape documentation built on April 4, 2022, 1:51 p.m.