##################################################################
## Wreath Data Figure ##
##################################################################
# Load libraries
library(mclust)
library(colorspace)
# Load wreath data
data(wreath)
# Set a random seed (in case one is needed)
set.seed(20190129)
# Fit the Mclust model
MC <- Mclust(wreath, G = 14, modeNames = 'VVV')
# Open a plot device
pdf(file='./Wreath.pdf',width=6,height=6,paper='special')
# Plot the data colored by the subpopulations
plot(wreath,col=rainbow_hcl(14)[MC$classification],
xlab=expression(y[1]),ylab=expression(y[2]), lwd = 2)
grid()
# Plot subpopulation means
points(MC$parameters$mean[1,],MC$parameters$mean[2,],
pch=4,cex=2,lwd=3)
# Close plot device
dev.off()
#################################################################
## Iris1 Results ##
#################################################################
# Load libraries
library(reshape2)
library(colorspace)
# Load result data
load('Iris1.rdata')
# Rename the columns of the data
colnames(Results) <- c('EM','N=n/10','N=n/10,P','N=n/5','N=n/5,P','N=n/10,T','N=n/10,PT','N=n/5,T','N=n/5,PT')
# Melt the data
DF <- melt(Results)
# Open a plot device
pdf(file='./Iris1.pdf',width=12,height=6,paper='special')
# Construct boxplot
boxplot(value ~ Var2, data = DF, lwd = 2, ylab = 'log-likelihood',range=0)
# Insert a grid
grid()
# Plot points over boxplot
stripchart(value ~ Var2, vertical = TRUE, data = DF,
method = "jitter", add = TRUE, pch = 20,
col = rainbow_hcl(dim(Results)[2]+1,alpha=0.5)[DF$Var1])
# Close plot device
dev.off()
#################################################################
## Iris2 Results ##
#################################################################
# Load libraries
library(reshape2)
library(colorspace)
# Load result data
load('Iris2.rdata')
# Rename the columns of the data
colnames(Results) <- c('EM','N=n/10','N=n/10,P','N=n/5','N=n/5,P','N=n/10,T','N=n/10,PT','N=n/5,T','N=n/5,PT')
# Melt the data
DF <- melt(Results)
# Open a plot device
pdf(file='./Iris2.pdf',width=12,height=6,paper='special')
# Construct boxplot
boxplot(value ~ Var2, data = DF, lwd = 2, ylab = 'log-likelihood',range=0)
# Insert a grid
grid()
# Plot points over boxplot
stripchart(value ~ Var2, vertical = TRUE, data = DF,
method = "jitter", add = TRUE, pch = 20,
col = rainbow_hcl(dim(Results)[2]+1,alpha=0.5)[DF$Var1])
# Close plot device
dev.off()
#################################################################
## Wreath1 Results ##
#################################################################
# Load libraries
library(reshape2)
library(colorspace)
# Load result data
load('Wreath1.rdata')
# Rename the columns of the data
colnames(Results) <- c('EM','N=n/10','N=n/10,P','N=n/5','N=n/5,P','N=n/10,T','N=n/10,PT','N=n/5,T','N=n/5,PT')
# Melt the data
DF <- melt(Results)
# Open a plot device
pdf(file='./Wreath1.pdf',width=12,height=6,paper='special')
# Construct boxplot
boxplot(value ~ Var2, data = DF, lwd = 2, ylab = 'log-likelihood',range=0)
# Insert a grid
grid()
# Plot points over boxplot
stripchart(value ~ Var2, vertical = TRUE, data = DF,
method = "jitter", add = TRUE, pch = 20,
col = rainbow_hcl(dim(Results)[2]+1,alpha=0.5)[DF$Var1])
# Close plot device
dev.off()
#################################################################
## Wreath2 Results ##
#################################################################
# Load libraries
library(reshape2)
library(colorspace)
# Load result data
load('Wreath2.rdata')
# Rename the columns of the data
colnames(Results) <- c('EM','N=n/10','N=n/10,P','N=n/5','N=n/5,P','N=n/10,T','N=n/10,PT','N=n/5,T','N=n/5,PT')
# Melt the data
DF <- melt(Results)
# Open a plot device
pdf(file='./Wreath2.pdf',width=12,height=6,paper='special')
# Construct boxplot
boxplot(value ~ Var2, data = DF, lwd = 2, ylab = 'log-likelihood',range=0)
# Insert a grid
grid()
# Plot points over boxplot
stripchart(value ~ Var2, vertical = TRUE, data = DF,
method = "jitter", add = TRUE, pch = 20,
col = rainbow_hcl(dim(Results)[2]+1,alpha=0.5)[DF$Var1])
# Close plot device
dev.off()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.