View source: R/constructGradient.R
| constructGradient | R Documentation | 
Constructs an environmental gradient over one of the variables included in XData
constructGradient( hM, focalVariable, non.focalVariables = list(), ngrid = 20, coordinates = list() )
hM | 
 a fitted   | 
focalVariable | 
 focal variable over which the gradient is constructed  | 
non.focalVariables | 
 list giving assumptions on how non-focal variables co-vary with the focal variable or a single number given the default type for all non-focal variables  | 
ngrid | 
 number of points along the gradient (for continuous focal variables)  | 
coordinates | 
 A named list of coordinates were model is
evaluated in spatial or temporal models. The name should be one
of the random levels, and value can be   | 
In basic form, non.focalVariables is a list, where each element is on the form variable=list(type,value),
where variable is one of the non-focal variables, and the value is needed only if type = 3. Alternatives
type = 1 sets the values of the non-focal variable
to the most likely value (defined as expected value for covariates, mode for factors),
type = 2 sets the values of the non-focal variable to most likely value, given the value of focal variable,
based on a linear relationship, and
type = 3 fixes to the value given.
As a shortcut, a single number 1 or 2 can be given as a type
used for all non-focal variables.
If a non.focalVariable is not listed, type=2 is used as default.
Note that if the focal variable is continuous, selecting type 2 for a non-focal categorical variable can cause abrupt changes in response.
The function needs access to the original XData data frame,
and cannot be used if you defined your model with X model
matrix. In that case you must construct your gradient manually.
a named list with slots XDataNew, studyDesignNew and rLNew
plotGradient, predict.
# Construct gradient for environmental covariate called 'x1'. Gradient = constructGradient(TD$m, focalVariable="x1") # Construct gradient for environmental covariate called 'x1' # while setting the other covariate to its most likely values Gradient = constructGradient(TD$m, focalVariable="x1",non.focalVariables=list(x2=list(1)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.