--- title: "LOL Simulations" author: "Eric Bridgeford" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{sims} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r} require(lolR) require(ggplot2) require(MASS) n <- 1000 d <- 15 ``` ```{r} plot_sim <- function(X, Y, name, d1=1, d2=2) { data <- data.frame(x1=X[,d1], x2=X[,d2], y=Y) data$y <- factor(data$y) ggplot(data, aes(x=x1, y=x2, color=y)) + geom_point() + xlab("x1") + ylab("x2") + ggtitle(name) } ``` Below, we visualize the different simulation settings with `n=400` in `d=50` dimensions: # Trunk, 2 Class ```{r, fig.width=5} testdat <- lol.sims.rtrunk(n, d, b=20) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "Trunk, 2 Class")) ``` # Rotated Trunk, 2 Class, non-equal priors In this simulation, we show the trunk, estimate a rotation matrix to apply to the mean and covariances, and use a non-equal prior with more class 1 than class 2. ```{r, fig.width=5} testdat <- lol.sims.rtrunk(n, d, rotate=TRUE, priors=c(0.8, 0.2), b=20) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "Rotated Trunk, 2 Class, non-equal priors")) ``` # Trunk, 3 Class ```{r, fig.width=5} testdat <- lol.sims.rtrunk(n, d, b=20, K=3) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "Trunk, 3 Class")) ``` # Mean Difference ```{r, fig.width=5} testdat <- lol.sims.mean_diff(n, d) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "Mean Difference 2 Class")) ``` # Toeplitz ```{r, fig.width=5} testdat <- lol.sims.toep(n, d) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "Toeplitz")) ``` # QD- Toeplitz ```{r, fig.width=5} testdat <- lol.sims.qdtoep(n, d) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "QD-Toeplitz")) ``` # XOR ```{r, fig.width=5} testdat <- lol.sims.xor2(n, d) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "XOR")) ``` # Cigar ```{r, fig.width=5} testdat <- lol.sims.cigar(n, d) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "Cigar")) ``` # Fat Tails ```{r, fig.width=5} testdat <- lol.sims.fat_tails(n, d) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "Fat Tails")) ``` # Cross ```{r, fig.width=5} testdat <- lol.sims.cross(n, d, a=4, b=.25) X <- testdat$X Y <- testdat$Y print(plot_sim(X, Y, "Cross", d1=7, d2=8)) ```