Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

spStack (version 1.0.1)

simBinary: Synthetic point-referenced binary data

Description

Dataset of size 500, with a binary response variable indexed by spatial coordinates sampled uniformly from the unit square. The model includes one covariate and spatial random effects induced by a Matérn covariogram.

Usage

data(simBinary)

Arguments

Format

a data.frame object.

s1, s2

2-D coordinates; latitude and longitude.

x1

a covariate sampled from the standard normal distribution.

y

response vector (0/1).

z_true

true spatial random effects that generated the data.

Author

Soumyakanti Pan span18@ucla.edu,
Sudipto Banerjee sudipto@ucla.edu

Details

With n=500, the binary data is simulated using y(si)Bernoulli(π(si)),i=1,,n,π(si)=ilogit(x(si)β+z(si)) where the function ilogit refers to the inverse-logit function, the spatial effects zN(0,σ2R) with R being a n×n correlation matrix given by the Matérn covariogram R(s,s)=(ϕ|ss|)νΓ(ν)2ν1Kν(ϕ|ss|), where ϕ is the spatial decay parameter and ν the spatial smoothness parameter. We have sampled the data with β=(0.5,0.5), ϕ=5, ν=0.5, and σ2=0.4. This data can be generated with the code as given in the example below.

See Also

simGaussian, simPoisson, simBinom

Examples

Run this code
set.seed(1729)
n <- 500
beta <- c(0.5, -0.5)
phi0 <- 5
nu0 <- 0.5
spParams <- c(phi0, nu0)
spvar <- 0.4
sim1 <- sim_spData(n = n, beta = beta, cor.fn = "matern",
                   spParams = spParams, spvar = spvar, deltasq = deltasq,
                   family = "binary")
plot1 <- surfaceplot(sim1, coords_name = c("s1", "s2"), var_name = "z_true")

library(ggplot2)
plot2 <- ggplot(sim1, aes(x = s1, y = s2)) +
  geom_point(aes(color = factor(y)), alpha = 0.75) +
  scale_color_manual(values = c("red", "blue"), labels = c("0", "1")) +
  guides(alpha = 'none') +
  theme_bw() +
  theme(axis.ticks = element_line(linewidth = 0.25),
        panel.background = element_blank(),
        panel.grid = element_blank(),
        legend.title = element_text(size = 10, hjust = 0.25),
        legend.box.just = "center", aspect.ratio = 1)

Run the code above in your browser using DataLab