Learn R Programming

BayesSPsurv (version 0.1.4)

plot_Moran.I: plot_Moran.I

Description

Implements Global Moran I test to evaluate spatial autocorrelation in a units' risk propensity in the data. Positive values indicate spatial clustering of similar values.

Usage

plot_Moran.I(
  data,
  var_duration = character(),
  var_id = character(),
  var_time = character(),
  n = 1,
  t = 1.645,
  threshold = 800L
)

Arguments

data

data.

var_duration

variable that measures duration until censoring or failure.

var_id

ID's unique identifier.

var_time

variable that measures time.

n

number of observation per id.

t

value of the confidence interval.

threshold

distance in kilometers. By default is 800.

Value

A ggplot object

Examples

Run this code
# NOT RUN {
library(BayesSPsurv)
dataw <- spduration::add_duration(data = BayesSPsurv::Walter_2015_JCR,
                                  y = "renewed_war",
                                  unitID = "ccode",
                                  tID = "year",
                                  freq = "year",
                                  ongoing = FALSE)


plot_Moran.I(data = dataw ,
            var_duration = "duration",
            var_id = "ccode",
            var_time = "year",
            n = 12)


# }

Run the code above in your browser using DataLab