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
# Load required libraries | |
library(dplyr) | |
library(ggplot2) | |
# Set seed for reproducibility | |
set.seed(123) | |
# Define hospitals | |
hospitals <- c("Hospital A", "Hospital B", "Hospital C", "Hospital D", "Hospital E") |
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
# Load required libraries | |
library(ggplot2) | |
library(rstanarm) | |
# Generate sample data | |
set.seed(123) | |
data <- data.frame( | |
age_group = sample(c("18-30", "31-45", "46-60", "61+"), 100, replace = TRUE), | |
gender = sample(c("Male", "Female"), 100, replace = TRUE), | |
income_group = sample(c("Low", "Medium", "High"), 100, replace = TRUE), |
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
""" | |
Union Find template for me. | |
""" | |
MAX_SIZE = 10000005 | |
class UnionFind: | |
def __init__(self): | |
self.height = [0]*MAX_SIZE | |
self.father=[0]*MAX_SIZE |
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
# Set seed for reproducibility | |
set.seed(123) | |
# Number of observations | |
n <- 1000 | |
# Simulate age group (categorical with 4 levels) | |
age_group <- sample(1:4, n, replace = TRUE) | |
# Simulate gender (binary: 0 = male, 1 = female) |
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
# Set seed for reproducibility | |
set.seed(123) | |
# Number of observations | |
n <- 1000 | |
# Simulate age group (categorical with 4 levels) | |
age_group <- sample(1:4, n, replace = TRUE) | |
# Simulate gender (binary: 0 = male, 1 = female) |
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
# Set seed for reproducibility | |
set.seed(123) | |
# Generate random data for independent variables | |
n <- 100 # Number of observations | |
earth <- rnorm(n) | |
fire <- rnorm(n) | |
wind <- rnorm(n) | |
water <- rnorm(n) |
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
set.seed(71) | |
num_friends = 20 | |
edward_measurements <- rnorm(num_friends, mean = 180, sd = 5) | |
hugo_measurements <- rnorm(num_friends, mean = 180, sd = 11) | |
lucy_measurements <- rnorm(num_friends, mean = 180, sd = 7) | |
height_data <- data.frame( |