Description Usage Arguments Value Author(s) See Also Examples
This function calculates the intensity surface
at each posterior realization and then computes
the average for the intensity surface over a fine grid.
The result is a much smoother posterior estimator
of the intensity surface, which is not necessarily
the same as the surface of posterior means,
which is obtained by GetPMEst
.
For examples see
http://faculty.missouri.edu/~micheasa/sppmix/sppmix_all_examples.html#plot_avgsurf
1 2 3 |
fit |
An object the contains all posterior realizations, e.g., the return
value from |
win |
An object of class |
LL |
Length of the side of the square grid. The density or intensity is calculated on an L * L grid. The larger this value is, the slower the calculation, but the better the approximation. |
burnin |
Number of initial realizations to discard. By default, it is 1/10 of the total number of iterations. |
zlims |
The limits of the z axis. Defaults to [0,1.1*max(intensity)]. |
grayscale |
Logical flag to request a gray scale plot. |
showplot |
Logical flag to request that the plot will be shown. Set to FALSE if you want to return the |
An image as an object of class im.object
.
Jiaxun Chen, Sakis Micheas
rnormmix
,
to_int_surf
,
rsppmix
,
est_mix_damcmc
,
plot_density
,
ggtitle
,
geom_point
,
plotmix_3d
,
GetPMEst
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 32 | truemix <- rnormmix(m = 5, sig0 = .1, df = 5, xlim= c(-1, 1), ylim =c(0, 3))
trueintsurf=to_int_surf(truemix, lambda = 200, win =spatstat::owin( c(-1, 1),c(0, 3)))
plot(trueintsurf, main = "True Poisson intensity surface (mixture of normal components)")
pp1 <- rsppmix(trueintsurf)
# Run Data augmentation MCMC and get posterior realizations
postfit=est_mix_damcmc(pp1,m=5)
# Plot the average of the surfaces of the posterior realizations
avgsurf=plot_avgsurf(postfit, LL = 50)
p<-plot_density(as.data.frame(avgsurf))+ggplot2::ggtitle(
"Average surface of the posterior realization surfaces\n x denotes a true component mean")
#show the point pattern points
pp_df <- data.frame(pp1$x,pp1$y)
names(pp_df) <- c("x", "y")
p<-p + ggplot2::geom_point(data = pp_df,size=0.8)
#show the true means
mean_df <- data.frame(do.call(rbind, trueintsurf$mus))
names(mean_df) <- c("x", "y")
p + ggplot2::geom_point(data = mean_df, color = "red", shape = "x", size = 5)
#repeat for the contour plot
p<-plot_density(as.data.frame(avgsurf),contour = TRUE)+ggplot2::ggtitle(
"Average surface of the posterior realization surfaces\n x denotes a true component mean")
#show the point pattern points
pp_df <- data.frame(pp1$x,pp1$y)
names(pp_df) <- c("x", "y")
p<-p + ggplot2::geom_point(data = pp_df,size=0.8)
#show the true means
mean_df <- data.frame(do.call(rbind, trueintsurf$mus))
names(mean_df) <- c("x", "y")
p + ggplot2::geom_point(data = mean_df, color = "red", shape = "x", size = 5)
#plot the 3d surface again based on the returned object
plotmix_3d(avgsurf,title1 = paste("Average of", .9*postfit$L,
"posterior realizations of the intensity surface"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.