Skip to content

Instantly share code, notes, and snippets.

View JonasMoss's full-sized avatar

Jonas Moss JonasMoss

View GitHub Profile
@JonasMoss
JonasMoss / causality_first_meeting.md
Last active August 28, 2019 09:24
Causality Reading Group: Proposed Reading Materials

First Reading

On the Consistency Rule in Causal Inference Axiom, Definition, Assumption, or Theorem? (Pearl, 2010, 4 page) One of the big problems with the causality literature is the terminology and the lack of foundationas for everyone to agree on.(Think about a vector space -- everyone agrees what it is. That's where we want to be.) The consistency rule appears to me to be the corner-stone of an axiomatic development of causality theory.

The following papers are mentioned in the Pearl paper and are a part of the assignment:

  1. The consistency statement in causal inference: a definition or an assumption

  2. Concerning the consistency assumption in causal inference

@JonasMoss
JonasMoss / talent.csv
Created September 22, 2021 10:45
Talent data set.
country points talent
1 Spain 1485 85
2 Germany 1300 76
3 Brazil 1242 48
4 Portugal 1189 16
5 Argentina 1175 35
6 Switzerland 1149 9
7 Uruguay 1147 9
8 Colombia 1137 3
9 Italy 1104 67
@JonasMoss
JonasMoss / bullshit.csv
Created September 23, 2021 14:31
Bullshit
free_market_ideology bullshit_receptivity
1 40 3.1
2 30 2.66666666666667
3 70 3.3
4 10 1.9
5 50 3.56666666666667
6 35 3.93333333333333
7 50 2.03333333333333
8 50 2.53333333333333
9 25 1
@JonasMoss
JonasMoss / exercise.py
Created November 2, 2021 13:05
Exercise function!
from collections import Counter
def f(i, s):
total = np.cumsum([0] + list(Counter(coding(s)).values()))
total = total / total[-1]
values = np.diff(total)
return values[i-1]
coding(data_student['apply'],f
@JonasMoss
JonasMoss / defaults.py
Created November 4, 2021 09:59
Default values in Python for EBA3500.
### Here's some more info about default values!
### Especially when they are difficult to understand.
### An easy example of default values.
def f(x, a = True):
if a:
return (x + 1)
if not a:
return (x + 2)
@JonasMoss
JonasMoss / kde_sampling_epanechnikov_kernel.R
Created February 13, 2018 17:52
Sampling from an Epanechnikov kernel density estimate in R.
#' Sample from a kernel density with the Epanechnikov kernel.
#'
#' @param n Number of observations to sample.
#' @param x The data from which the estimate is to be computed.
#' @param bw Desired bandwidth.
#' @return A numeric vector with n sampled data points from the kernel
#' density estimator.
#' @details The factor sqrt(5) in is needed since the standard deviation of
#' the kernel is 1/sqrt(5). This makes the normal kernel and the Epanchnikov
#' kernel comparable.