estima {starm}R Documentation

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 dim(data)[1] = dim(covariate)[1] (same numbers of individuals) and dim(data)[1] = dim(covariate)[1] + 3 as the covaiate dataset must not contain coordinates, but must match the coodinates of the dataset; and T-1 years (T is the number of years in the dataset "data") as the model needs the first year to initialize. See "User guides, package vignettes and other documentation" the "estima" vignette.

covariate2

spatio-temporal covariate. The covariate dataframe must have dim(data)[1] = dim(covariate)[1] (same numbers of individuals) and dim(data)[1] = dim(covariate)[1] + 3 as the covaiate dataset must not contain coordinates, but must match the coodinates of the dataset; and T-1 years (T is the number of years in the dataset "data") as the model needs the first year to initialize. See "User guides, package vignettes and other documentation" the "estima" vignette.

covariate3

spatio-temporal covariate. The covariate dataframe must have dim(data)[1] = dim(covariate)[1] (same numbers of individuals) and dim(data)[1] = dim(covariate)[1] + 3 as the covaiate dataset must not contain coordinates, but must match the coodinates of the dataset; and T-1 years (T is the number of years in the dataset "data") as the model needs the first year to initialize. See "User guides, package vignettes and other documentation" the "estima" vignette.

norm

"euclidean", "inf", "abs", "lin". norm = "euclidean" by default. See vignette Build.

vxpresent

positive real. Parameter of the ellipse for the tested neighborhood on x-axes in norm "norm" if swpresent = FALSE. If swpresent = TRUE, vxpresent will be the upper bound of the tested neighborhoods on x-axes in norm norm. See swpresent.

vypresent

positive real. Parameter of the ellipse for the tested neighborhood on y-axes in norm "norm" if swpresent = FALSE. If swpresent = TRUE, vypresent will be the upper bound of the tested neighborhoods on y-axes in norm norm. See swpresent.

vxpast

positive real. Parameter of the ellipse for the tested neighborhood on x-axes in norm "norm" if swpast = FALSE. If swpast = TRUE, vxpast will be the upper bound of the tested neighborhoods on x-axes in norm norm. See swpast. Only use if pastcov = TRUE.

vypast

positive real. Parameter of the ellipse for the tested neighborhood on y-axes in norm "norm" if swpast = FALSE. If swpast = TRUE, vypast will be the upper bound of the tested neighborhoods on y-axes in norm norm. See swpast. Only use if pastcov = TRUE.

dx

positive real : distance between sites on x-axis. dx = 1 by default.

dy

positive real : distance between sites on y-axis. dy = 1 by default.

swpresent

if TRUE the programm will test all possible neighborhood for the spatial autocorrelation (coefficient rho1) with parameters vxmaxpresent, vymaxpresent, dx and dy, otherwise the programm will test the neighborhood with the parameters vxpresent and vypresent. swpresent = TRUE by default.

swpast

if TRUE the programm will test all possible neighborhood for the autoregression on on the sum of the Zi,t-1 (coefficient Betapast) with parameters vxmaxpast, vymaxpast, dx and dy, otherwise the programm will test the neighborhood with the parameters vxpast and vypast. swpast = TRUE by default.

graph

if graph = TRUE, the program will also return the plot of the dataset for the last time (and the year before if estima = 3). graph = FALSE by default.

pastcov

boolen. If pastcov = TRUE, the function will use the past neighborhood as a covariate. See "User guides, package vignettes and other documentation" the "estima" vignette. pastcov = FALSE by default.

buildpres

boolean which allow the use of a custom neighborhood matrix. buildpres = NULL by default.

buildpast

boolean which allow the use of a custom neighborhood matrix. buildpast = NULL by default.

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)




[Package starm version 0.1.0 Index]