Skip to content

Instantly share code, notes, and snippets.

View EoinTravers's full-sized avatar

Eoin Travers EoinTravers

View GitHub Profile
@EoinTravers
EoinTravers / better_lrt.py
Last active August 4, 2022 14:12
Likelhood ratio tests for python statsmodels GLMs
# This version is more complicated, but can handle > 2 models and throws an error on non-nested models.
import numpy as np
from scipy import stats
import statsmodels.formula.api as smf
import pandas as pd
def likelihood_ratio_test(*models):
'''Model comparison via likelihood ratio chi-square test
See https://en.wikipedia.org/wiki/Likelihood-ratio_test
---
title: "MVN + Regression Interactions"
author: "Eoin Travers"
date: "`r Sys.Date()`"
output: html_document
---
https://twitter.com/realHollanders/status/1605462357697667072?s=20&t=sfGV7iiPavt6DwCrMdks-w
```{r}
@EoinTravers
EoinTravers / long_string.txt
Created January 26, 2024 11:26
Need a string of a specific length for debugging purposes? For a 100-charachter string, select up to the end of "100", etc. '\n' newlines count as one charachter.
........10........20........30........40........50
.......60........70........80........90.......100
......110.......120.......130.......140.......150
......160.......170.......180.......190.......200
......210.......220.......230.......240.......250
......260.......270.......280.......290.......300
......310.......320.......330.......340.......350
......360.......370.......380.......390.......400
......410.......420.......430.......440.......450
......460.......470.......480.......490.......500
@EoinTravers
EoinTravers / structured-conversation.ipynb
Last active February 18, 2025 20:35
Code from eointravers.com/blog/structured-conversation/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.