Skip to content

Instantly share code, notes, and snippets.

View chelseaparlett's full-sized avatar

Chelsea Parlett Pelleriti chelseaparlett

View GitHub Profile
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 = " ")
@chelseaparlett
chelseaparlett / BoxBreathe.py
Created August 30, 2021 18:15
Box Breathe with python
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
#---libs---------------------------------------------------
library(ltm)
library(jsonlite)
library(tidyverse)
library(patchwork)
library(stargazer)
library(rstan)
library(brms)
library(viridis)
library(plotly)
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
# fake data
library(bayesAB)
library(MCMCpack)
plotInvGamma(2, 2.5) + geom_vline(xintercept = 1)
set.seed(8675309)
n <- 60
p <- 500
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
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) +
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
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]))
@chelseaparlett
chelseaparlett / Birb.R
Created March 28, 2020 18:57
ggplot graphs as birds
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"),