Skip to content

Instantly share code, notes, and snippets.

@Arokiarajan1
Arokiarajan1 / replacing_seaborn_distplot.ipynb
Created October 28, 2023 08:27 — forked from mwaskom/replacing_seaborn_distplot.ipynb
A guide to replacing the deprecated `seaborn.distplot` function.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
library(tigris)
library(sf)
# Get shapefile from UNL Drought Monitor
# https://droughtmonitor.unl.edu/data/shapefiles_m/USDM_20210427_M.zip
# Explode the shapes then shift geometry
drought <- st_read("USDM_20210427.shp") %>%
st_cast("POLYGON") %>%
shift_geometry()
@Arokiarajan1
Arokiarajan1 / logistic_regression_testing_hypotheses.md
Created January 11, 2024 19:55 — forked from adrianolszewski/logistic_regression_testing_hypotheses.md
Logistic regression is often used for testing hypotheses, replacing a variety of common classic tests

Despite the widespread and nonsensical claim, that "logistic regression is not a regression", it constitutes one of the key regression and hypothesis testing tools used in the experimental research (like clinical trials).

Let me show you how the logistic regression (with a few extensions) can be used to test hypotheses about fractions (%) of successes, repacling the classic "test for proportions". Namely, it can replicate the results of:

  1. the Wald's (normal approximation) z test for 2 proportions with non-pooled standard errors (common in clinical trials) via LS-means on the prediction scale or AME (average marginal effect)
  2. the Rao's score (normal appr.) z test for 2 proportions with pooled standard errors (just what the prop.test() does in R)
  3. the z test for multiple (2+) proportions
  4. ANOVA-like (joint) test for multiple caterogical predictors (n-way ANOVA). Also (n-way) ANCOVA if you employ numerical covariates.
  5. [the **Cochran-Mantel-Haenszel
@Arokiarajan1
Arokiarajan1 / llm_plotting_streamlit_app.py
Created April 20, 2024 00:13 — forked from michaelgorkow/llm_plotting_streamlit_app.py
llm_driven_plotting_in_streamlit_in_snowflake.
# Make sure to add all requirements to Streamlit in Snowflake via the package selection!
# snowflake-ml-python, plotly, matplotlib, seaborn
# Import python packages
import streamlit as st
st.set_option('deprecation.showPyplotGlobalUse', False)
st.set_page_config(layout="wide")
import re
from snowflake.snowpark import functions as F
from snowflake.core import Root
from snowflake.cortex import Complete