LVIclust: Local variables importance (LVI) clustering from GWRFC...

Description Usage Arguments Value Examples

View source: R/LVIclust.R

Description

This function summarize results from the GWRFC algorithm, clustering its main outputs (i.e. LVI) and using these results to report a summary based on its data source (i.e. the input_shapefile). It is also possible to use any other specific variable (e.g. probabilities of a target class) to generate reports but in ths case clustering is not applied and the variable is subset in quantiles (if numerical) or by classes (if categorical) to generate the report.

Usage

1
2
LVIclust(input_shapefile, input_GWRFC, method_hc = "ward.D2",
  clus_data = "LVI", clus_num = "auto", plots = T, output_folder)

Arguments

input_shapefile

string or Spatial-class. Input shapefile with dependent and independent variables. It can be the filename of the shapefile or an object of class SpatialPolygonsDataFrame or SpatialPointsDataFrame.

input_GWRFC

string or Spatial-class. Input shapefile of GWRFC outputs. It can be the filename of the shapefile or an object of class SpatialPolygonsDataFrame or SpatialPointsDataFrame.

method_hc

string. A method to use for hierarchical clustering with hclust. It can be:"ward.D","ward.D2","single","complete","average","mcquitty","median", "centroid" or "SOM". The latter, is calculated with the kohonen library.

clus_data

string. Data which should be used in clustering. It can be "LVI" to refer to all LVI variables used during GWRFC. Other specific column at input_GWRFC can be also used. In this case, hierarchical clustering is not applied and target variable is reclassified into quantiles if data is numerical, otherwise input is converted to factor and its levels used for report.

clus_num

numeric or string. If applies hierarchical clustering, then it is the number of clusters. If it is defined as 'auto' (default), it is automatically calculated applying Calinski-Harabasz Index.

plots

logical. If true, plots are generated and stored in the output_folder.

output_folder

string. Output folder where LVIclust outputs will be stored.

Value

The output of this function is a shapefile with the resulting clusters, a summary for each cluster stored in a .rds file, and optionally a series of plots to visualize the report.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#based in the example showed with the execution of GWRFC
list.files("C:/DATA/demo/deforestation",full.names=T,pattern=".shp") #get the output filename from GWRFC function

LVIclust(input_shapefile = deforestation, #should be the same shapefile used to apply GWRFC (do not need to remove variables)
         input_GWRFC = "C:/DATA/demo/deforestation/GWRFC_ADP_400_exponential.shp", #filename of the GWRFC output
         method_hc="ward.D2", #hierarchical clustering is applied but see: help(hclust) for other methods.
         clus_data="LVI", #here is clustered all LVI results (34 in total, i.e. the number of variables used in the analysis).
         clus_num = 2, #number of clusters. It can be automatically calculated if it is 'auto'
         plots=T, #three plots referring to: LVI ranking by clusters, report for categorial and quantitative variables by cluster.
         output_folder = "C:/DATA/demo/deforestation") #check this folder for outputs generated by the function.

FSantosCodes/GWRFC documentation built on Sept. 16, 2019, 5:14 a.m.