Plot Data

Øystein Olav Skaar

2018-06-19

Plot Data

Enjoy this brief demonstration of the plot data module

First we simulate some data and estimate means and standard deviations

Plot the data as repeated measures

plot1

plot1

Lets add some noise

Plot the noise as repeated measures

plot2

plot2

Let’s add a group

combined.data <- as.data.frame(rbind(cbind(data,"Y"), cbind(noise,"X") ), stringsAsFactors=FALSE)
combined.data[,1:3] <- lapply(combined.data[,1:3] , as.numeric)
combined.data[,4] <- as.factor(combined.data[,4])
colnames(combined.data) <- c(colnames(data), "Groups")

combined.data <- bfw::bfw(project.data = combined.data,
                     y = "Before,During,After",
                     x = "Groups",
                     job.title = "Stages of Cheese",
                     saved.steps = 50000,
                     jags.model = "mean",
                     jags.seed = 102,
                     silent = TRUE)

# Print output
round(combined.data$summary.MCMC[, 3:7],3)
#>                                   Mode   ESS  HDIlo  HDIhi    n
#> mu[1]: Before                    0.359 50000  0.309  0.407 2000
#> mu[2]: Before vs. Groups @ X     0.713 50000  0.641  0.779 1000
#> mu[3]: Before vs. Groups @ Y    -0.002 50000 -0.063  0.062 1000
#> mu[4]: During                    5.342 50000  5.293  5.391 2000
#> mu[5]: During vs. Groups @ X     5.683 49103  5.616  5.754 1000
#> mu[6]: During vs. Groups @ Y     4.998 50000  4.938  5.062 1000
#> mu[7]: After                    10.344 50000 10.293 10.390 2000
#> mu[8]: After vs. Groups @ X     10.688 49245 10.618 10.754 1000
#> mu[9]: After vs. Groups @ Y      9.999 50000  9.938 10.063 1000
#> sigma[1]: Before                 1.119 50000  1.086  1.155 2000
#> sigma[2]: Before vs. Groups @ X  1.119 48125  1.071  1.169 1000
#> sigma[3]: Before vs. Groups @ Y  0.998 50000  0.958  1.045 1000
#> sigma[4]: During                 1.112 50000  1.079  1.148 2000
#> sigma[5]: During vs. Groups @ X  1.115 49356  1.068  1.165 1000
#> sigma[6]: During vs. Groups @ Y  0.999 50000  0.957  1.045 1000
#> sigma[7]: After                  1.105 50000  1.072  1.140 2000
#> sigma[8]: After vs. Groups @ X   1.098 50000  1.054  1.150 1000
#> sigma[9]: After vs. Groups @ Y   1.000 50000  0.957  1.045 1000
# Let's also add some colors!
bfw::PlotData(combined.data, run.split = TRUE, run.repeated = TRUE ,  monochrome = FALSE)

Plot the split data

plot3

plot3