Skip to content

Instantly share code, notes, and snippets.

View chelseaparlett's full-sized avatar

Chelsea Parlett Pelleriti chelseaparlett

View GitHub Profile
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
# fake data
library(bayesAB)
library(MCMCpack)
plotInvGamma(2, 2.5) + geom_vline(xintercept = 1)
set.seed(8675309)
n <- 60
p <- 500
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
#---libs---------------------------------------------------
library(ltm)
library(jsonlite)
library(tidyverse)
library(patchwork)
library(stargazer)
library(rstan)
library(brms)
library(viridis)
library(plotly)
@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
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 = " ")
#libs--------------
library(grid)
library(tidyverse)
library(ggdark)
#funs--------------
irt <- function(a,b,c){
theta <- seq(-10,10, length = 500)
exponent <- exp(a*(theta-b))
phat <- c + (1-c)*(exponent/(1 + exponent))
library(readr)
library(tidyverse)
# read in data
urlfile <- "https://raw.githubusercontent.com/Z-Unlocked/Unlocked_Challenge_1/main/temperature_change_data_11-29-2021.csv"
mydata <-read_csv(url(urlfile))
# filter
countries <- c("China", "Germany", "Japan", "United States of America")
library(tidyverse)
# create named list
l <- list(x = data.frame(a = rnorm(10), b = rnorm(10)),
y = data.frame(a = rnorm(10), b = rnorm(10)),
z = data.frame(a = rnorm(10), b = rnorm(10)))
for (i in names(l)){
if (i %in% c("x", "y")){ # if the name of the list item is in a specified sublist
l[[i]] <- l[[i]] %>% mutate(c = a + 1) # then do the mutate
from shiny import App, render, ui, reactive
from pathlib import Path
# Import modules for plot rendering
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd