Package 'SpICE'

Title: An interpretable method based on ICE curves for spatial data
Description: SpICE: An interpretable machine learning approache using ICE curves for spatial data. Compute ICE curves clusters with geographical constrains and visualization.
Authors: Natalia da Silva [aut, cre] (ORCID: <https://orcid.org/0000-0002-6031-7451>), Ignacio Alvarez [aut] (ORCID: <https://orcid.org/0000-0003-1633-2432>)
Maintainer: Natalia da Silva <[email protected]>
License: GPL (>= 3)
Version: 0.0.0.9000
Built: 2026-06-01 11:01:14 UTC
Source: https://github.com/natydasilva/SpICE

Help Index


Cluster ICE curves, transforming the ICE curves first and use for the clusters geographical information

Description

Cluster ICE curves, transforming the ICE curves first and use for the clusters geographical information

Usage

cl_sobcurve(DD0, DD1, alp = 0.5, yhat = NULL, grid, icevalue)

Arguments

DD0

data.frame with ICE curve information.

DD1

data.frame with coordinate information asociated to ice curves values named lat and long.

alp

numeric value between 0 and 1 which represents the weight fo D0 (ICE curve information) respect to location value.

yhat

Name of each ice curve id.

grid

Name of the grid value variable.

icevalue

Name of ice curve variable.

Value

data.frame

Examples

## Not run: 
cl_sobcurve(DD0 = curveDT, DD1 = coordDT, yhat = yhat.id, grid = grid.val, ice = ice)

## End(Not run)

Data with location information asociated to ice curves values

Description

data.frame with 1000 rows and five columns

  • long Group id

  • lat refractive index

  • grlab Grid id

  • yhat.id Ice curve values

Usage

data(coordDT)

Format

A data frame with 214 rows and 10 variables


Data with ICE curve information

Description

data.frame with 1000 rows and five columns

  • grlab Group id

  • yhat.id ice curve id

  • grid.point Grid id

  • ice Ice curve values

  • gridval Grid value

Usage

data(curveDT)

Format

A data frame with 214 rows and 10 variables


Function to compute and visualize optimum alpha cluster values

Description

Function to compute and visualize optimum alpha cluster values

Usage

plot_alpha(
  DD1,
  DD0,
  resp = NULL,
  nfrac = 0.2,
  yhat,
  icevalue,
  grid,
  clRange = 3:5,
  alpRange = seq(0, 1, 0.2)
)

Arguments

DD1

data.frame with coordinate information asociated to ice curves values named lat and long.

DD0

data.frame with ICE curve information.

resp

response vector to perform stratified sample

nfrac

sampling fraction

yhat

Name of each ice curve id

icevalue

Name of ice curve variable.

grid

Name of the grid value variable.

clRange

Numeric vector with posible values of number of cluster.

alpRange

Numeric vector with posible values of alpha parameter.

Value

A list with cluster metric for each value of alpRange and clRange, and a visualization of the intertia decomposition.

Examples

## Not run: 
plot_alpha( DD0 = curveDT, DD1 = coordDT, yhat = yhat.id, icevalue = ice, grid = grid.val)

## End(Not run)

Plot map including geographical location of observations colored by groups using ggmap

Description

Plot map including geographical location of observations colored by groups using ggmap

Usage

plot_clcoord(
  data = NULL,
  gg,
  gr = NULL,
  sz = 0.5,
  aa = 0.7,
  fct = TRUE,
  zz = 13,
  long,
  lat,
  region = NULL
)

Arguments

data

data.frame with the data to be ploted having the variables longitude and latitude, named long and lat

gg

name of the group id variable.

gr

vector with the selected groups to be ploted.

sz

line widht in the plot.

aa

numeric value for transparency in the plot.

fct

logical value to inicate facets in the plot.

zz

a zoom level for map

long

variable name with the longitude data.

lat

variable name with latitude data.

region

a bounding box in the format c(lowerleftlon, lowerleftlat, upperrightlon, upperrightlat), see example

Value

A ggplot2 object.

Examples

## Not run: 
montevideo <- c(left = -56.286532, bottom = -34.95, right = -56.004532, top =-34.801112 )
plot_clcoord(data = coordDT, gg = grlab, gr = 1:4, region = montevideo)

## End(Not run)

Plot clustered ICE curves using ggplot2

Description

Plot clustered ICE curves using ggplot2

Usage

plot_clcurve(
  data = NULL,
  icevalue = NULL,
  gg,
  yhat,
  gr = NULL,
  sz = 0.5,
  aa = 1/100,
  xlab = NULL,
  ylab = NULL,
  fct = TRUE,
  xvalue = NULL
)

Arguments

data

data.frame with the data to be ploted

icevalue

Name of ice curve variable.

gg

Name of the group id variable.

yhat

Name of each ice curve id.

gr

vector with the selected groups to be ploted.

sz

line widht in the plot.

aa

numeric value for transparency in the plot.

xlab

string with x axis label.

ylab

string with y axis label.

fct

logical value to inicate facets in the plot.

xvalue

variable name with grid values ploted in x axis.

Value

A ggplot2 object

Examples

## Not run: 
plot_clcurve(data = curveDT, icevalue = ice, gg = grlab, yhat = yhat.id, 
gr = 1:4, xvalue = grid.val, aa =1/20)

## End(Not run)