Type: | Package |
Title: | Spatio-Temporal Autologistic Regression Model |
Version: | 0.1.0 |
Author: | Yannis Barboni [aut, cre], Anne Gegout-Petit [aut], Shuxian Li [aut] |
Description: | Estimates the coefficients of the two-time centered autologistic regression model based on Gegout-Petit A., Guerin-Dubrana L., Li S. "A new centered spatio-temporal autologistic regression model. Application to local spread of plant diseases." 2019. <doi:10.48550/arXiv.1811.06782>, using a grid of binary variables to estimate the spread of a disease on the grid over the years. |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
Maintainer: | Yannis Barboni <yannis.barboni1@gmail.com> |
RoxygenNote: | 6.1.1 |
Imports: | Matrix |
Suggests: | ggplot2,knitr, rmarkdown |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2020-04-09 11:11:31 UTC; yanni |
Depends: | R (≥ 3.5.0) |
Repository: | CRAN |
Date/Publication: | 2020-04-10 10:20:05 UTC |
Creation of the neighbourhood's matrix.
Description
Creation of the neighbourhood's matrix.
Usage
build(data = 0, vx = 3, vy = 3, dx = 1, dy = 1, selec = FALSE,
t = 0, norm = "euclidean", returnplot = FALSE)
Arguments
data |
dataset with first column the X-coordinates of the sites and the second the Y-coodinates of the sites. |
vx |
integer, first parameter of the neighbourhood ( i.e. first parameter of ellipse if |
vy |
integer, second parameter of the neighbourhood ( i.e. second parameter of ellipse if |
dx |
positive real, distance between sites on a row. |
dy |
positive real, distance between sites on a column. |
selec |
see |
t |
double. If |
norm |
Response type : "euclidean" "inf" "abs" "lin". |
returnplot |
If |
Details
The function will return the neighborhood matrix of a dataset which must contain coodinates in the two first columns and a third column at least with the "type" of each site (it can be only "0" or "1" for example). The parameter norm
let you choose between 4 sorts of neighborhood : 3 ellipses in norm 1, 2 or infinite (resp "abs","euclidean" and "inf") with the parameters vx
and vy
which are the width and the height of the ellipse, and the norm lin
will condider only sites on the same row and column with the same parameters vx
and vy
.
Value
The neighborhood matrix
Note
If returnplot = TRUE
, variable$plot
will return an exemple of the choosen neighborhood on a center point of the dataset.
Examples
data <- plantillness
v <- which((data$NRang <= 20))
data <- data[v,]
v <- which(data$NCep <= 20)
data<-data[v,]
res <- build(data = data)
#Example with the plantillness dataset and the plot available :
res <- build(data = plantillness,returnplot = TRUE,vx = 5,vy = 5)
#Example with the plantillness dataset, only considering the sites of the type "0" :
res <- build(data = plantillness, selec = TRUE, t = c(0),vx = 5,vy = 7,norm = "inf")
Covariate data
Description
covplant is the dataset of the spatial covariate of the plantillness dataset. Each column can be used as a covariate along the plantillness dataset in the estima function. Each row of a selected covariate matches a point of the plantillness dataset, that's why there is no coordinates in the covplant dataset.
Usage
covplant
Format
An object of class data.frame
with 2366 rows and 3 columns.
Details
$v1 spatial covariate
$v2 spatial covariate
$v3 spatial covariate
Source
no source
Estimation of parameters of autologistic regression model for data on a grid
Description
Estimation of parameters of autologistic regression model for data on a grid
Usage
estima(data = 0, covariate1 = NULL, covariate2 = NULL,
covariate3 = NULL, norm = "euclidean", vxpresent = 3,
vypresent = 3, vxpast = 3, vypast = 3, dx = 1, dy = 1,
swpresent = TRUE, swpast = TRUE, graph = FALSE, pastcov = FALSE,
buildpres = NULL, buildpast = NULL)
Arguments
data |
dataset with the coordinates in the two first columns. |
covariate1 |
spatio-temporal covariate. The covariate dataframe must have |
covariate2 |
spatio-temporal covariate. The covariate dataframe must have |
covariate3 |
spatio-temporal covariate. The covariate dataframe must have |
norm |
|
vxpresent |
positive real. Parameter of the ellipse for the tested neighborhood on x-axes in norm |
vypresent |
positive real. Parameter of the ellipse for the tested neighborhood on y-axes in norm |
vxpast |
positive real. Parameter of the ellipse for the tested neighborhood on x-axes in norm |
vypast |
positive real. Parameter of the ellipse for the tested neighborhood on y-axes in norm |
dx |
positive real : distance between sites on x-axis. |
dy |
positive real : distance between sites on y-axis. |
swpresent |
if |
swpast |
if |
graph |
if |
pastcov |
boolen. If |
buildpres |
boolean which allow the use of a custom neighborhood matrix. |
buildpast |
boolean which allow the use of a custom neighborhood matrix. |
Details
See "User guides, package vignettes and other documentation"
the "estima"
vignette.
Value
list : estimate parameters using the pseudo-likelihood.
Examples
data <- plantillness
v <- which(data$NRang <= 10)
data <- data[v,]
v <- which(data$NCep <= 10)
data<-data[v,]
result <- estima(data = data)
#Example in "lin" norm, with a fixed neighborhood :
result <- estima(data = plantillness, norm = "lin",swpresent = FALSE,vxpresent = 3, vypresent = 4)
#Example with a spatial covariate (adapted to the dimension of the dataset) :
cov <- covplant[,1]
for (i in (1:(dim(plantillness)[2] - 4))){
cov <- cbind(cov,covplant[,1])
}
result <- estima(data = plantillness,covariate1 = cov)
#Example with the past neighborhood as covariate:
result <- estima(data = plantillness,pastcov = TRUE)
#Exemple with a custom neighborhood matrix
custompres <- build(data = plantillness)
custompast <- build(data = plantillness, vx = 5,vy = 6)
result <- estima(data = plantillness,pastcov = TRUE,buildpres = custompres,buildpast = custompast)
Illness data
Description
plantillness is a dataset representing a vineyard of the Bordeaux region
Usage
plantillness
Format
An object of class data.frame
with 2366 rows and 16 columns.
Details
$NRang : rows of the vines
$NCep : position in the row of the vines
$X2004 : state of the vine at the position (NRang,NCep) in 2004
$X2005 : state of the vine at the position (NRang,NCep) in 2005
$X2006 : state of the vine at the position (NRang,NCep) in 2006
$X2007 : state of the vine at the position (NRang,NCep) in 2007
$X2008 : state of the vine at the position (NRang,NCep) in 2008
$X2009 : state of the vine at the position (NRang,NCep) in 2009
$X2010 : state of the vine at the position (NRang,NCep) in 2010
$X2011 : state of the vine at the position (NRang,NCep) in 2011
$X2012 : state of the vine at the position (NRang,NCep) in 2012
$X2013 : state of the vine at the position (NRang,NCep) in 2013
$X2014 : state of the vine at the position (NRang,NCep) in 2014
$X2015 : state of the vine at the position (NRang,NCep) in 2015
$X2016 : state of the vine at the position (NRang,NCep) in 2016
$X2017 : state of the vine at the position (NRang,NCep) in 2017
Source
no source