This file contains 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 os | |
import asyncio | |
import streamlit as st | |
import numpy as np | |
from openai import AsyncOpenAI, NOT_GIVEN as OPENAI_NOT_GIVEN | |
openai_api_key = os.getenv("OPENAI_API_KEY", st.secrets["OPENAI_API_KEY"]) | |
openai_client_async = AsyncOpenAI() |
This file contains 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(dplyr) | |
library(tidyr) | |
library(ggplot2) | |
library(brms) | |
library(qcc) | |
#set.seed(1569) # First 100 | |
set.seed(8536) # Next 1000 | |
# B <- 100 # First time through |
This file contains 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(dplyr) | |
library(tidyr) | |
sim_df <- bind_rows( | |
tibble(group='A', y=rnorm(100, mean=33)), | |
tibble(group='B', y=rnorm(10000, mean=30)), | |
tibble(group='C', y=rnorm(100, mean=33.1)) | |
) |
This file contains 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(dplyr) | |
# Structural Equations --------------------------------------------------- | |
get_subject_affinity <- function(N) { | |
# u ~ Uniform(1, 20) | |
runif(N, min=1, max=20) | |
} | |
get_time_resources <- function(N) { | |
# w ~ Gamma(3, 1) |
This file contains 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
# See Wiki @ https://github.com/USEPA/useeior/Wiki for install instructions | |
library(useeior) | |
seeAvailableModels() | |
# explanation of model names can be found at | |
# https://github.com/USEPA/USEEIO/blob/master/VersioningScheme.md | |
# LCI: direct perspective life cycle inventory result | |
# LCIA: life cycle impact assessment | |
# Build USEEIO v2.0-GHG |
This file contains 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
# pip install ananke-causal | |
from ananke import graphs | |
from ananke import identification | |
from ananke.estimation import CausalEffect | |
import numpy as np | |
import pandas as pd | |
# Simulate front-door situation with confounder Z | |
N = 100000 |
This file contains 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 pandas as pd | |
import numpy as np | |
import patsy | |
import tensorflow as tf | |
class SleepReg(tf.Module): | |
def __init__(self, sleepdata_path): | |
"""Initializing tensorflow variables and other necessary matrices""" | |
# These two TensorFlow variables show up in the trainable_variables |
This file contains 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
N <- 10000 | |
theta <- 1.4 | |
e <- rnorm(N) | |
e_lag <- c(NA, e[1:(N-1)]) | |
y <- e - theta * e_lag | |
acf(y[2:N]) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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(dplyr) | |
library(ggplot2) | |
library(splines) | |
days_grid <- 0:180 | |
interior_knots <- c(2, 6, 25) | |
#interior_knots <- c(6, 25, 80) | |
my_spline <- ns(days_grid, knots = interior_knots) |
NewerOlder