Commit 358d4269 authored by Theodore Papamarkou's avatar Theodore Papamarkou
Browse files

Added R script for plotting log-likelihood of ring data

parent d1b9a02f
Loading
Loading
Loading
Loading

log_lik/ring_plots.r

0 → 100644
+35 −0
Original line number Diff line number Diff line
filenames <- c("depth0.csv", "depth0-0.csv", "depth1-1.csv", "depth2-2.csv", "depth1-1-1.csv")

for (i in seq(1, length(filenames))) {
  dframe <- read.csv(filenames[i], header=TRUE)

  cols <- c("black", "red", "blue", "green", "purple")
  
  if (i == 1) {
    plot(dframe$lik, type="o", col=cols[i], xaxt="n", ylim=c(-3400, 0), xlab="Width", ylab="Log-likelihood")
    axis(side=1, at=seq(1, 10), labels = FALSE)
    text(x=seq(1, 10),  par("usr")[3], labels=c(1, 2, 3, 4, 5, 10, 50, 100, 500, "Inf"), pos = 1, xpd = TRUE)
  }
  else {
    lines(dframe$lik, type="o", col=cols[i], xaxt="n")
  }
}

legend("topleft", legend=filenames, col=cols, lty=c(1, 1, 1, 1, 1), lwd=c(2, 2, 2, 2, 2))

for (i in seq(1, length(filenames))) {
  dframe <- read.csv(filenames[i], header=TRUE)
  
  cols <- c("black", "red", "blue", "green", "purple")
  
  if (i == 1) {
    plot(log(-dframe$lik), type="o", col=cols[i], xaxt="n", ylim=c(-1, 8), xlab="Width", ylab="Log of negative log-likelihood")
    axis(side=1, at=seq(1, 10), labels = FALSE)
    text(x=seq(1, 10),  par("usr")[3], labels=c(1, 2, 3, 4, 5, 10, 50, 100, 500, "Inf"), pos = 1, xpd = TRUE)
  }
  else {
    lines(log(-dframe$lik), type="o", col=cols[i], xaxt="n")
  }
}

legend("bottomleft", legend=filenames, col=cols, lty=c(1, 1, 1, 1, 1), lwd=c(2, 2, 2, 2, 2))