plotmix_2d: 2d exploratory plots for mixture intensity surfaces

Description Usage Arguments Author(s) See Also Examples

Description

Create a 2d image or contour plot of the intensity surface, with the option to display a point pattern.

For examples see

http://faculty.missouri.edu/~micheasa/sppmix/sppmix_all_examples.html#plotmix_2d

Usage

1
2
3
plotmix_2d(intsurf, pattern, estcomp, contour = FALSE, truncate = TRUE,
  L = 256, open_new_window = FALSE, grayscale = FALSE, colors = FALSE,
  ...)

Arguments

intsurf

Object of class intensity_surface or normmix.

pattern

Optional spatial point pattern to add to the plot. This is an object of class ppp.

estcomp

The estimated component label should be a vector whose length should be the same as number of points. If estcomp is not missing, the function will plot the points using different colors according to estcomp. See the example on how to calculate estcomp from a DAMCMC fit. If this variable is missing and we pass a point pattern generated using rsppmix, then the true component labels will be used, otherwise, the function will not plot the points with different colors to indicate the different components.

contour

Logical flag requesting the countour plot only.

truncate

Logical variable indicating that the points should be within the window of observation. Default is TRUE.

L

Length of the side of the square grid. The intensity is calculated on an L * L grid. The larger this value is, the better the picture resolution.

open_new_window

Open a new window for the plot.

grayscale

Plot in gray scale. Default is FALSE (use colors).

colors

Logical flag requesting to use different colors for the points based on which component they belong to.

...

Additional parameters passed to to_int_surf().

Author(s)

Jiaxun Chen, Sakis Micheas, Yuchen Wang

See Also

normmix, to_int_surf, owin, rsppmix, GetMAPLabels, est_mix_damcmc, PlotUSAStates

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# plot normmix density
truemix<- rnormmix(m = 3, sig0 = .1, df = 5, xlim= c(0, 5), ylim = c(0, 5))
summary(truemix)
intsurf=to_int_surf(truemix, lambda = 100, win =spatstat::owin( c(0, 5),c(0, 5)))
#plot the intensity surface
plotmix_2d(intsurf)
plotmix_2d(intsurf,contour = TRUE)
pp1 <- rsppmix(intsurf = intsurf)# draw points
plotmix_2d(intsurf, pp1)
plotmix_2d(intsurf, pp1,contour = TRUE)
#fit a Poisson with mixture intensity surface
CAgens=est_mix_damcmc(pp = CAQuakes2014.RichterOver3.0, m = 5)
#retrieve the surface of posterior means
CAfit=GetPMEst(CAgens)
#plot the surface and the point pattern
plotmix_2d(CAfit,CAQuakes2014.RichterOver3.0)
#to include the state boundaries use function PlotUSAStates
ret=PlotUSAStates(states=c('California','Nevada','Arizona'), showcentroids=FALSE,
 shownames=TRUE, main="Earthquakes in CA, 2014", pp=CAQuakes2014.RichterOver3.0,
 surf=CAfit, boundarycolor="white", namescolor="white")
#plotting the points with different colors depending on the component they belong to
truemix <- rnormmix(m = 5, sig0 = .1, df = 5, xlim=c(-2,2), ylim=c(-2,2))
intsurf=to_int_surf(truemix, lambda = 100, win = spatstat::owin(c(-2,2),c(-2,2)))
pp1 <- rsppmix(intsurf)
#plot the points with different colors depending on the true component label
plotmix_2d(intsurf,pp1, colors = TRUE)
#plot the points with different colors depending on the estimated component label
fit <- est_mix_damcmc(pp1, 5)
est_comp <- GetMAPLabels(fit)
plotmix_2d(intsurf,pp1, estcomp = est_comp, colors = TRUE)
plotmix_2d(intsurf,pp1, estcomp = est_comp, contour = TRUE,colors = TRUE)

sppmix documentation built on Jan. 13, 2021, 10:04 p.m.