This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| terms <- c("error", "random", "model", | |
| "mixed", "linear", "effects", | |
| "variance") | |
| probs <- c(0.1,0.1, 0.55, 0.05, 0.05, 0.1, 0.05) | |
| new_jargon <- sample(terms, | |
| size = sample(c(2,3),1), | |
| prob = probs) | |
| new_jargon <- paste(new_jargon, collapse = " ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import time | |
| def breath(prompt = "Hold------------"): | |
| print(prompt) | |
| time.sleep(1) | |
| for i in range(2,5): | |
| print(str(i)) | |
| time.sleep(1) | |
| breaths = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #---libs--------------------------------------------------- | |
| library(ltm) | |
| library(jsonlite) | |
| library(tidyverse) | |
| library(patchwork) | |
| library(stargazer) | |
| library(rstan) | |
| library(brms) | |
| library(viridis) | |
| library(plotly) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| library(rstan) | |
| library(bayesplot) | |
| #code | |
| model_code <- " | |
| data { | |
| int<lower = 2> K; // # of categories | |
| vector[K] priorprobs; //prior | |
| int<lower=0> n_total_1; //total in group 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # fake data | |
| library(bayesAB) | |
| library(MCMCpack) | |
| plotInvGamma(2, 2.5) + geom_vline(xintercept = 1) | |
| set.seed(8675309) | |
| n <- 60 | |
| p <- 500 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| library("viridis") | |
| n <- 100 | |
| sd <- 10 | |
| cutoffz_r <- qnorm(0.975) * (sd/sqrt(n)) | |
| cutoffz_l <- -cutoffz_r | |
| min_ES <- 0.28 | |
| min_raw <- min_ES*sd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(ggplot2) | |
| library(palmerpenguins) | |
| library(MASS) | |
| #penguin-------------------------------------------------- | |
| penguins <- na.omit(penguins) | |
| ggplot(penguins, aes(x = bill_length_mm, bill_depth_mm)) + | |
| geom_point() + | |
| facet_wrap(sex~species) + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| a <- read.csv(url("https://raw.githubusercontent.com/cmparlettpelleriti/CPSC392ParlettPelleriti/master/Data/PopDivas_data.csv")) | |
| b <- read.csv(url("https://raw.githubusercontent.com/cmparlettpelleriti/CPSC392ParlettPelleriti/master/Data/cereal.csv")) | |
| c <- read.csv(url("https://raw.githubusercontent.com/cmparlettpelleriti/CPSC392ParlettPelleriti/master/Data/BreastCancer.csv")) | |
| #red yellow blue purple green pink black white rainbow | |
| library(ggplot2) | |
| red <- ggplot(a, aes(x = artist_name, y = energy, fill = artist_name)) + | |
| geom_violin() + scale_fill_manual(values = c("red", "red1", "red2", "red3", "red4", "firebrick4")) + | |
| geom_boxplot() + ggtitle("Pop Divas Song Energy") | |
| red |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| calculateWeights <- function(dfData, row){ | |
| wi <- dnorm(dfData$x, row[,"means"], row[,"var"]) | |
| return(wi) | |
| } | |
| normalize.choose <- function(weights, dfDist){ | |
| wis <- sapply(1:ncol(weights), | |
| function(x) (weights[,x]*dfDist[,"ak"])/sum(weights[,x]*dfDist[,"ak"])) | |
| chosen <- sapply(1:ncol(weights), function(x) which.max(wis[,x])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(tidyverse) | |
| # 1 | |
| d <- read.csv(url("https://raw.githubusercontent.com/cmparlettpelleriti/CPSC392ParlettPelleriti/master/Data/Beyonce_data.csv")) | |
| ggplot(d,aes(x = factor(mode), y = danceability)) + geom_boxplot(aes(fill = factor(mode))) + | |
| scale_fill_manual(values = c("#f83703", "#000000")) + | |
| labs(title = "Dancibility of Beyonce Songs by Major and Minor Key", x = "mode") + | |
| theme(legend.position = "none", panel.background = element_rect(fill = "#78a741", colour = "#83ba7d"), | |
| panel.grid.major = element_line(colour = "burlywood3"), |