View source: R/best_Spatial_CorrStruct.R
best_Spatial_CorrStruct | R Documentation |
When through the function (modelCheck_plots) spatial autocorrelation is found in the residuals of a model performed
with (gls) or (lme), it may be necessary to specify the structure of this spatial correlation through the 'correlation' argument.
Among the different correlation structures (see (CorStruct)), those supported by the present function are:
corGaus –> Gaussian spatial correlation
corExp –> Exponential spatial correlation
corSpher –> Spherical spatial correlation
corLin –> Linear spatial correlation.
See @examples section for operative details
best_Spatial_CorrStruct( data, X, Y, var.res, range, sill, nugget, spatial.formula )
data |
a data.frame used as data input in the model |
X |
column within the dataset containing the coordinates X (e.g.: dataset$X) |
Y |
column within the dataset containing the coordinates Y (e.g.: dataset$Y) |
var.res |
column within the dataset containing the response variable or model residuals obtained with residuals(model,type="pearson") see @examples |
range |
value of the 'range' identifiable from the semivariogram obtained with (modelCheck_plots). |
sill |
value of the 'sill' identifiable from the semivariogram obtained with (modelCheck_plots). |
nugget |
value of the 'nugget' identifiable from the semivariogram obtained with (modelCheck_plots). |
spatial.formula |
a one sided formula of the form ~ S1+...+Sp, or ~ S1+...+Sp | g, specifying spatial covariates S1 through Sp and, optionally, a grouping factor g. For more details see the 'form' argument of e.g. (corGaus). |
Linear, exponential, gaussian and spherical models plotted on the semivariogram.
It is also provided in the console the string to copy and paste in 'correlation' argument in the functions: (gls), (lme) of 'nlme' package"
Gałecki, A., & Burzykowski, T. (2013). Linear mixed-effects model. In Linear mixed-effects models using R (pp. 245-273). Springer, New York, NY.
Jack Weiss tutorial (2012). Fitting theoretical models to the empirical semivariogram
1- define from (modelCheck_plots) which are the values of range, sill, and nugget. For a definition of range, sill, and nugget terminology see here
2- run 'best_Spatial_CorrStruct' function: best_Spatial_CorrStruct(data=Dataset, X = Dataset$X, Y = Dataset$Y, var.res = residuals(model,type="pearson"), range = 5, sill = 5, nugget = 4, spatial.formula = "~ X + Y")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.