Title: | Spatial Influence of Landscape |
---|---|
Description: | Method to estimate the spatial influence scales of landscape variables on a response variable. The method is based on Chandler and Hepinstall-Cymerman (2016) Estimating the spatial scales of landscape effects on abundance, Landscape ecology, 31: 1383-1394, <doi:10.1007/s10980-016-0380-z>. |
Authors: | Carpentier F. and Martin O. |
Maintainer: | Martin Olivier <[email protected]> |
License: | GPL (>= 2.0) | file LICENSE |
Version: | 3.0.2 |
Built: | 2024-12-23 06:49:55 UTC |
Source: | CRAN |
Method to estimate the spatial influence scales of landscape variables on a response variable. The method is based on Chandler and Hepinstall-Cymerman (2016) Estimating the spatial scales of landscape effects on abundance, Landscape ecology, 31: 1383-1394, <doi:10.1007/s10980-016-0380-z>. This package allows for analyzing the effect of landscape features on georeferenced point observations (described in a Geographic Information System shapefile format). It simultaneously estimates the spatial scales and intensities of landscape variable effects. It does not require any information about the scale of effect. It allows for effects tests, effects maps and models comparison. \
The DESCRIPTION file:
Package: | siland |
Type: | Package |
Title: | Spatial Influence of Landscape |
Version: | 3.0.2 |
Date: | 2023-03-23 |
Author: | Carpentier F. and Martin O. |
Maintainer: | Martin Olivier <[email protected]> |
Description: | Method to estimate the spatial influence scales of landscape variables on a response variable. The method is based on Chandler and Hepinstall-Cymerman (2016) Estimating the spatial scales of landscape effects on abundance, Landscape ecology, 31: 1383-1394, <doi:10.1007/s10980-016-0380-z>. |
License: | GPL (>= 2.0) | file LICENSE |
Depends: | base, graphics, stats, sf, R (>= 3.5.0) |
Imports: | lme4, sp, raster, ggplot2, ggforce, fasterize, reshape2, fields, methods |
NeedsCompilation: | no |
Packaged: | 2023-03-30 09:14:52 UTC; biosp |
Suggests: | knitr, rmarkdown |
VignetteBuilder: | knitr |
RoxygenNote: | 7.1.2 |
Repository: | CRAN |
Date/Publication: | 2023-03-30 14:20:12 UTC |
Config/pak/sysreqs: | cmake libfontconfig1-dev libfreetype6-dev libgdal-dev gdal-bin libgeos-dev make libicu-dev libssl-dev libproj-dev libsqlite3-dev libudunits2-dev |
Index of help topics:
AIC.siland Akaike's An Information Criterion for siland package BIC.siland Bayesian Information criterion bufferforsiland Percentage of landscape variable in buffers. dataSiland Simulated data fitted.siland Extract siland model Fitted values landSiland Simulated landscape. landtoraster Transformation of an sf object into raster plot.siland Plot an object of class siland plotsiland Plot results from siland function plotsiland.land Map of siland result plotsiland.sif Plot the estimated spatial influence functions. print.siland siland print residuals.siland Extract siland Residuals siland Estimation of landscape influence using siland method (Spatial Influence Function) siland-package Spatial Influence of Landscape siland.lik -(Loglikelihood) as a function of SIF parameters. siland.quantile Quantile of spatial influence function (SIF) summary.siland The function gives a summary of an object of class siland
Further information is available in the following vignettes:
siland |
Siland: Spatial Influence of landscape (source, pdf) |
Carpentier F. and Martin O. Maintainer: Martin Olivier <[email protected]>
Function calculating thue usual Akaike's 'An Information Criterion' for an object of class siland, according to the formula -2*loglikelihood+k*npar, with npar the number of parameters of the model and k = 2.
## S3 method for class 'siland' AIC(object,...,k=2)
## S3 method for class 'siland' AIC(object,...,k=2)
object |
an object of class siland |
... |
Dots are not take into account in this version |
k |
not used |
AIC value
O. Martin
Sakamoto, Y., Ishiguro, M., and Kitagawa G. (1986). Akaike Information Criterion Statistics. D. Reidel Publishing Company.
Function computing the Bayesian Information Criterion for an object of class siland, according to the formula -2*loglikelihood+k*npar, with npar the number of parameters of the model and k = log(n) (n being the number of observations).
## S3 method for class 'siland' BIC(object,...)
## S3 method for class 'siland' BIC(object,...)
object |
an object of class siland |
... |
Dots are not take into account in this version |
BIC value
O. Martin
Function computing the percentages of landscape variables in buffers of given sizes (i.e. radii).
bufferforsiland(d, sfGIS, loc.sf, landnames, border = F)
bufferforsiland(d, sfGIS, loc.sf, landnames, border = F)
d |
a vector of the distances of the buffer sizes. The length of |
sfGIS |
an object of class sf containing the landscape variables (land uses). Landscape variables are equal to 1 (presence) or 0 (absence). |
loc.sf |
an object of class sf or a dataframe containing locations of buffers centers. For dataframe, locations have to be given in columns "X" and "Y". |
landnames |
a vector of characters of the names of the landscape variables |
border |
a logical ( |
a dataframe containing the percentages of the landscape variables named landnames
(in columns) in buffers of sizes described in d
and centered on locations described in loc.sf
(in rows).
Martin O.
data(dataSiland) data(landSiland) dataSiland[1:10,c("X","Y")] landSiland$L1 landSiland$L2 res=bufferforsiland(c(100,200),sfGIS=landSiland, loc.sf=dataSiland, landnames=c("L1","L2")) res
data(dataSiland) data(landSiland) dataSiland[1:10,c("X","Y")] landSiland$L1 landSiland$L2 res=bufferforsiland(c(100,200),sfGIS=landSiland, loc.sf=dataSiland, landnames=c("L1","L2")) res
Simulated data of response variable and local variables.
data("dataSiland")
data("dataSiland")
A data frame with 100 observations on 5 variables.
[,1] | X | numeric | location on X-axis |
[,2] | Y | numeric | location on Y-axis |
[,3] | x1 | numeric | a continous local variable |
[,4] | Id | numeric | identifier |
[,5] | obs | numeric | response variable |
data(dataSiland) plot(dataSiland[,c("X","Y")])
data(dataSiland) plot(dataSiland[,c("X","Y")])
Function extracting fitted values of an object of class siland.
## S3 method for class 'siland' fitted(object,...)
## S3 method for class 'siland' fitted(object,...)
object |
an object of class siland |
... |
Dots are not take into accounbt in this version |
Fitted values extracted from the object object
.
O. Martin
Simulated landscape associated to dataSiland, containing two landscape variables, named L1 and L2.
data("landSiland")
data("landSiland")
A sf
object with 4884 observations on 3 variables.
[,1] | L1 | numeric | presence/absence of L1 (0/1) |
[,2] | L2 | numeric | presence/absence of L2 (0/1) |
[,3] | geometry | sfc_MULTIPOLYGON | polygon location |
data(landSiland) plot(landSiland$geometry) plot(landSiland[landSiland$L1==1,]$geometry,col=2,add=TRUE) plot(landSiland[landSiland$L2==1,]$geometry,col=3,add=TRUE)
data(landSiland) plot(landSiland$geometry) plot(landSiland[landSiland$L1==1,]$geometry,col=2,add=TRUE) plot(landSiland[landSiland$L2==1,]$geometry,col=3,add=TRUE)
Function transforming an object of class sf into raster (points grid) with wd
, the pixel size of the raster. landname
gives the variable names for which raster points have to be computed.
landtoraster(landgis, landname, wd)
landtoraster(landgis, landname, wd)
landgis |
an object of class sf |
landname |
vector of names of landscape variable for which rasters are computed. |
wd |
numeric, pixels size of raster |
a list of dataframes. The components of the list correspond to variables specifed in argument landname. Each dataframe gives the X and Y locations of pixels in raster.
O. Martin
##---- Should be DIRECTLY executable !! ---- ##-- ==> Define data, use random, ##-- or do help(data=index) for the standard data sets. data(dataSiland) data(landSiland) head(dataSiland) head(landSiland) u=landtoraster(landSiland,c("L1","L2"),wd=20) names(u) du1=as.data.frame(raster::rasterToPoints(u[[1]])) du2=as.data.frame(raster::rasterToPoints(u[[2]])) plot(du1[,1:2],type="n") sel1=du1[,3]==1 sel2=du2[,3]==1 points(du1[sel1,c(1,2)],pch=".",col=1) points(du2[sel2,c(1,2)],pch=".",col=2)
##---- Should be DIRECTLY executable !! ---- ##-- ==> Define data, use random, ##-- or do help(data=index) for the standard data sets. data(dataSiland) data(landSiland) head(dataSiland) head(landSiland) u=landtoraster(landSiland,c("L1","L2"),wd=20) names(u) du1=as.data.frame(raster::rasterToPoints(u[[1]])) du2=as.data.frame(raster::rasterToPoints(u[[2]])) plot(du1[,1:2],type="n") sel1=du1[,3]==1 sel2=du2[,3]==1 points(du1[sel1,c(1,2)],pch=".",col=1) points(du2[sel2,c(1,2)],pch=".",col=2)
This function calls the function plot.lm() and plot the object result stored in x
## S3 method for class 'siland' plot(x, ...)
## S3 method for class 'siland' plot(x, ...)
x |
an object of class siland |
... |
the same options as for the function plot.lm() |
Plot locations of observed data and locations of landscape variables. The black points correspond to the locations of observed data, and the size is propotional to numeric values. The locations of different landscape variables are displayed with small points of different colours. Estimated mean distance of spatial influence for each landscape variable is indicated beside the graphic with a continuous line. Dashed line indicates the radius that gives 95 percent of the total influence of each landscape variable.
plotsiland(res, land, data)
plotsiland(res, land, data)
res |
an object obtained from the function siland |
land |
an object of class sf that gives the landscape variables |
data |
a dataframe with the response variable and the local variables |
an object of class ggplot
data(dataSiland) data(landSiland) res=siland(obs~x1+L1+L2,land=landSiland,data=dataSiland,sif="exponential") plotsiland(res,landSiland, dataSiland)
data(dataSiland) data(landSiland) res=siland(obs~x1+L1+L2,land=landSiland,data=dataSiland,sif="exponential") plotsiland(res,landSiland, dataSiland)
Function creating a map of siland result, i.e. estimatied spatial influence of each landscape variable or for the cumulative effect of all variables.
plotsiland.land(x, land, data, var = 0, lw = 100, xlim=NULL, ylim=NULL,plot=T)
plotsiland.land(x, land, data, var = 0, lw = 100, xlim=NULL, ylim=NULL,plot=T)
x |
an object resulting from |
land |
the object of class sf describing the landscape variable, i.e. the |
data |
the dataframe describing response variable and the local variables, i.e. the |
var |
a vector containing the numbers (numeric) of the mapped landscape variables. If |
lw |
the number of pixels on x-axis and y-axis for the graphical representation. A too high value can lead to memory allocation problems. By default lw=100. |
xlim |
a length-2 numeric vector, lower and upper limits of x-axis. |
ylim |
a length-2 numeric vector, lower and upper limits of y-axis. |
plot |
a logical (TRUE by default). If TRUE, the result is a graphic. If FALSE, the result is a dataframe of the cumulative spatial influence of the landscape variable(s) var. |
an object of class ggplot
siland
data(dataSiland) data(landSiland) res=siland(obs~x1+L1+L2,land=landSiland,data=dataSiland,sif="exponential") plotsiland.land(x=res,land=landSiland,data=dataSiland) #plotsiland.land(x=res,land=landSiland,data=dataSiland,var=1,lw=20) #plotsiland.land(x=res,land=landSiland,data=dataSiland,var=2,lw=20)
data(dataSiland) data(landSiland) res=siland(obs~x1+L1+L2,land=landSiland,data=dataSiland,sif="exponential") plotsiland.land(x=res,land=landSiland,data=dataSiland) #plotsiland.land(x=res,land=landSiland,data=dataSiland,var=1,lw=20) #plotsiland.land(x=res,land=landSiland,data=dataSiland,var=2,lw=20)
Graphic representations for the different influence functions estimated with the function siland().
plotsiland.sif(x)
plotsiland.sif(x)
x |
an object obtained with function siland(). |
no value is returned
siland
data(dataSiland) data(landSiland) res=siland(obs~x1+L1+L2,land=landSiland,data=dataSiland,sif="exponential") plotsiland.sif(x=res)
data(dataSiland) data(landSiland) res=siland(obs~x1+L1+L2,land=landSiland,data=dataSiland,sif="exponential") plotsiland.sif(x=res)
function printing an object of class siland. It returns the model used and the estimated parameters.
## S3 method for class 'siland' print(x,...)
## S3 method for class 'siland' print(x,...)
x |
an object of class siland |
... |
not take into account in this version |
Function extracting residuals for an estimated siland model.
## S3 method for class 'siland' residuals(object,...)
## S3 method for class 'siland' residuals(object,...)
object |
an object of class siland |
... |
Dots are not take into account in this version |
Function estimating landscape effect (and eventual local effects) using siland method, i.e. estimating simultaneously : the SIF parameter (i.e. mean distance of SIF) and the effect of each landscape variable (and the effect of each local variable).
siland(formula,land,data,family ="gaussian",sif="exponential", init = 100, border=F,wd=50,maxD=3000)
siland(formula,land,data,family ="gaussian",sif="exponential", init = 100, border=F,wd=50,maxD=3000)
formula |
a symbolic description (see lm() or glm()) of the model to be fitted. The details of model specification are given under 'Details'. |
land |
an object of class sf containing the landscape variables. |
data |
a dataframe containing the response variable and the local variables. |
family |
the distribution of response variable. |
sif |
the family of the Spatial Influence Function. |
init |
a vector indicating the starting values for SIF parameters in the estimation procedure. By default, starting values of SIF parameters of all landscape variable are equal to 100. |
border |
a logical indicating wether the spatial influence of the polygon where observations are located is taken into account.
If |
wd |
a numeric, the size of pixels. |
maxD |
a numeric, give the maximum distance used to evaluate the influence of pixel on each observation. It is recommanded that maxD is greater than three times the greatest SIF value. |
The siland method is based on the model:
with
Y_i, response variable,
x_l,i, local variable l,
r, the discritzation of study site in pixels r
z^k_r, the value of the landscape variable k at the pixel r. If the landscape variable k is a presence/absence variable, z^k_r is equal to one or zero.
, the intercept
and
, the effects of local and landscape variables, respectively.
,the SIF associated with the landscape variable k with parameter
(the mean distance of the SIF, see detail further)
d_r,i the distance between the center of pixel r and the observation at site i.
All parameters, ,
,
but also
SIF parameters of the landscape variables are simultaneously estimated by likelihood maximization.
Models for siland have the form response ~ terms
where response
is the columns name of the response variable in data
and terms
is a series of terms which specifies the names of landscape and local explanatory variables. The explanatory variables described in data
are considered as local in the model, those described in the sf object land
are considered as landscape variables.
For local variables, random effects can be considered using the syntax (1|x)
similar to package lme4 (see lmer() function in package lme4). Interaction terms are not yet implemented in siland
contrary to Bsiland
.
The explanatory variables are added using the symbol "+"
. Interaction terms can be considered using the usual symbols "*"
or ":"
. Notice that only interactions between local x local and local x landscape variables are considered.
Two families of SIF are currently implemented in the siland package, exponential and Gaussian families defined as and
, respectively. By definition,
represents the mean distance of these SIF.
The computation of the spatial influence of landscape variables is based on an approximation through the description of landscape variables distribution along a regular grid (modelisation of spatial influence of each pixel of landscape variable). The choice of wd
, the size of pixels can have an impact on the estimation. The smaller the pixels, the more accurate the approximation, but also the longer the computation time. In our experience, we recommend using a pixel size at most three times smaller than the smallest estimated mean distance among the landscape variables SIF.
siland returns an object of type siland, a list :
coefficients |
a vector of the estimated coefficients |
paramSIF |
a vector of the estimated parameters of SIF |
formula |
an object of class formula that indicates the model |
landcontri |
a dataframe of estimated cumulative influence of each landscape variable (in columns) on each observation (in rows). |
loglik |
the estimated maximum loglikelihood |
loglik0 |
the estimated maximum loglikelihood of the local model (no landscape variable) |
result |
a lm/glm/lmer object that corresponds to the model estimate knowing the estimated SIF parameters of landscape variables. |
fitted |
the fitted values |
sif |
the family of the SIF |
resoptim |
an object of class optim or optimize giving informations about the optimization procedure see optim() or optimize() for further details. |
AIC |
the akaike information criterion of the model |
AIC0 |
the akaike information criterion of the local model (no landscape variable) |
nparam |
the number of parameters |
pval0 |
the p.value of the test of the landscape effect (the global effect of all spatial variables). Issued from the likelihood ratio test of the (complete) model vs the local model (complete model without landscape variables). |
family |
the family distribution for the model |
sd.error |
the estimated standard error for gaussian family, NA in other case |
model.Type |
the type of local model: GLM for generalised model, LMM for linear mixed model or GLMM for generalised linear mixed model |
rand.StdDev |
the estimated standard deviation of random effects for LMM or GLMM |
err |
the estimated residuals |
border |
a logical indicating the value used for estimation |
wd |
a number indicating the size of pixels |
Carpentier, F. and Martin, O.
Carpentier, F., & Martin, O. (2019). SILand: an R package for estimating the spatial influence of landscape. bioRxiv, 692566.
data(dataSiland) data(landSiland) res=siland(obs~x1+L1+L2,land=landSiland,data=dataSiland,sif="exponential") res res$AIC
data(dataSiland) data(landSiland) res=siland(obs~x1+L1+L2,land=landSiland,data=dataSiland,sif="exponential") res res$AIC
Function investigating eventual optimization problems during numerical optimization of function siland by plotting the -(loglikelihhod) against parameters of Spatial Influence Functions (SIF) of each landscape variable. The parameter of a SIF is defined as the mean distance of SIF.
siland.lik(res, land,data, varnames = NULL, seqd = seq(2, 2000, length = 10))
siland.lik(res, land,data, varnames = NULL, seqd = seq(2, 2000, length = 10))
res |
an object resulting from siland |
land |
the object of class sf describing the landscape variable, i.e. the |
data |
the dataframe describing response variable and the local variables, i.e. the |
varnames |
a vector containing the names (characters) of studied landscape variables. If varnames is |
seqd |
a vector of SIF parameters (positive values) for which the -loglikelihood is computed. |
As with all numerical maximisation procedures, optimization problems may arise. The function siland.lik
allows to point out possible problems of optimization.
siland.lik
plots the -Loglikelihood against SIF parameters. During the siland procedure, the estimation of SIF parameters is made by maximazing the likelihood i.e. by minimizing the -Loglikelihood. The orange horizontal line indicates the minimal value of -Loglikelihood obtained during the estimation (res
result).
The other continous curves represent the -loglikehood as a function of SIF parameters for each studied landscape variable (considering the other parameters of the model at their estimated value in res
). The dotted lines indicate the values of SIF parameter estimated (res
result).
When the minization correctly occurs, the minimal values of the -loglikelihoods for each landscape variable are equal to the value of the estimated minimal -Loglikelihood. This means that the value of each continuous curves is minimal at its intersection with the orange horizontal line. This also means that dotted lines intersect their associated continuous lines at their minimum.
If it is not the case, the minimizing procedure has failed and it is necessary to proceed again with an estimation with different initialisation values. This is possible with the argument init
in function siland
.
a ggplot of the -(loglikelihhod) against SIF parameters of each landscape variables.
O. Martin and F. Carpentier
data(dataSiland) data(landSiland) res=siland(obs~x1+L1+L2,data=dataSiland,land=landSiland) siland.lik(res,dataSiland,land=landSiland,varnames=c("L1","L2"),seqd=seq(5,500,length=20)) # Illustration of failed estimation caused by wrong initial # values (chosen initial values that are deliberately and obviously far too high) # In a such case, the estimation should be done again , # by calling siland with init=c(250,250) for instance. res2=siland(obs~x1+L1+L2,data=dataSiland,land=landSiland,init=c(20000,20000)) siland.lik(res2,dataSiland,land=landSiland,varnames=c("L1","L2"),seqd=seq(1e9,1e10,length=20))
data(dataSiland) data(landSiland) res=siland(obs~x1+L1+L2,data=dataSiland,land=landSiland) siland.lik(res,dataSiland,land=landSiland,varnames=c("L1","L2"),seqd=seq(5,500,length=20)) # Illustration of failed estimation caused by wrong initial # values (chosen initial values that are deliberately and obviously far too high) # In a such case, the estimation should be done again , # by calling siland with init=c(250,250) for instance. res2=siland(obs~x1+L1+L2,data=dataSiland,land=landSiland,init=c(20000,20000)) siland.lik(res2,dataSiland,land=landSiland,varnames=c("L1","L2"),seqd=seq(1e9,1e10,length=20))
function computing quantiles of SIF, i.e. the radius of disk on which the integrated influence of the SIF is equal to given proportions, p
. Calculations are performed for the estimated SIF of each landscape variable in x
.The area of medium influence and significant influence of a landscape variable, that we defined as the disc containing 50% and 95% of the influence of the SIF (neglecting 50% and 5% of its broader effect) respectively can be computed using argument p = 0.5
and p = 0.95
, respectively.
siland.quantile(x, p = 0.95)
siland.quantile(x, p = 0.95)
x |
an object of class siland resulting from function |
p |
a vector of probabilities |
A matrix of the radii of disks on wich the integrated influences of the SIF estimated for each landscape variable of x
(in columns) are equal to each probability of the vector p
(in rows).
O. Martin and F. Carpentier
data(dataSiland) data(landSiland) res=siland(obs~x1+L1+L2,land=landSiland,data=dataSiland,sif="exponential") #siland.quantile(x=res,p=c(0.5,0.95))
data(dataSiland) data(landSiland) res=siland(obs~x1+L1+L2,land=landSiland,data=dataSiland,sif="exponential") #siland.quantile(x=res,p=c(0.5,0.95))
The function gives a detailed summary of an object of class siland. It gives results as the summary for an object of type glm or lm.
## S3 method for class 'siland' summary(object,...)
## S3 method for class 'siland' summary(object,...)
object |
an object of type siland |
... |
Dots are not take into account in this version |