Skip to content

Instantly share code, notes, and snippets.

View Jsevillamol's full-sized avatar

Jaime Sevilla Jsevillamol

View GitHub Profile
import numpy as np
mu_A = np.log(10)
sigma_A = 0.1
mu_B = np.log(20)
sigma_B = 0.1
def lognorm_pdf(x,mu,sigma):
return np.exp(-(np.log(x)-mu)**2/(2*(sigma**2))) / (x*sigma*np.sqrt(2*np.pi))
// ~->[DNET-1]->~
// File created by Ingrid Zuckerman at MonashU using Netica 5.18 on Apr 04, 2018 at 08:49:56.
bnet Three_Nations_Problem___comple {
AutoCompile = TRUE;
autoupdate = TRUE;
whenchanged = 1522795722;
visual V1 {
import re
import numpy as np
import networkx as nx
from pgmpy.models import BayesianModel
from pgmpy.factors.discrete import TabularCPD
# Utilities
rhs = lambda s : re.match(r".*(.*) = (.*).*", s).group(2).strip(";")
my_tuple_reader = lambda s : list(filter(lambda s : len(s) > 0,
,Event,Victims (low),Victims (high),Victims,Location,Starting year,End year,No idea,,
1,Mongol sacking after the Siege of Baghdad (1258),"200,000[74]","2,000,000[75]",831,Baghdad,158,-234443,12 days,,
2,Biological warfare at the Siege of Fort Pitt,?,?,1073,"Pittsburgh, Pennsylvania",663,-49815,"1 months, 18 days",,
3,Massacre of Salsipuedes,40,40,200,Uruguay,431,The same day,1 day,,
4,Lawrence massacre,204,204,700,"Douglas County, Kansas",863,-13280,1 day,,
5,Fort Pillow massacre,235,235,800,"Lauderdale County, Tennessee",464,-13045,1 day,,
6,Johnstown Flood,"2,209[citation needed]","2,209[citation needed]",106,Pennsylvania,589,-3865,1 day,,
7,Indian Ocean slave trade,,"17,000,000[393][394]",1073,"Africa, Middle East, South Asia",293,1900s,4400 years,,
8,Punic Wars,"1,250,000[45]",1850000,763,Medi­terranean,499,146 BC,118 years,,
9,Kalinga War,1500000,2000000,342,India,499,261 BC,2 years,,
library(haven)
library(dplyr)
library(lfe)
# Inline string concatenation
`%+%` <- function(a, b) paste(a, b, sep="")
# Moran statistic
library(ape)
my_moran <- function(residuals_input, coordinates){
library(haven)
library(ape)
# Load data
slave_trade_QJE <- read_dta("R/datasets/slave_trade_QJE.dta")
# Compute regression
mylm <- lm(ln_maddison_pcgdp2000~ln_export_area
# Colony fixed effects
+ colony0 + colony1 + colony2 + colony3 + colony4 + colony5 + colony6 + colony7
@Jsevillamol
Jsevillamol / SlaveTradeTrust.dag
Created May 27, 2020 12:13
Slave trade and the origins of mistrust in Africa
dag {
"Country fixed effects" [pos="-0.870,0.635"]
"Ethnic composition in district of residence" [pos="-0.830,-0.431"]
"Ethnic fixed effects" [pos="0.016,-0.643"]
"Historical ethnic slave trade intensity" [exposure,pos="-1.439,0.072"]
"Individual characteristics" [pos="0.016,0.647"]
"Long term trust" [outcome,pos="0.697,0.041"]
"Country fixed effects" -> "Historical ethnic slave trade intensity"
"Country fixed effects" -> "Long term trust"
"Ethnic composition in district of residence" -> "Long term trust"
@Jsevillamol
Jsevillamol / gist:318564fd73081542434c3f2a75ffdd99
Last active May 23, 2020 11:25
DAG Testing population as a mediator of slave trade and long term prosperity
dag {
"Ethnic fractionalization" [pos="-0.656,0.548"]
"Historical population" [pos="-0.543,0.055"]
"Modern GPD per capita" [outcome,pos="0.182,0.314"]
"Population growth" [pos="-0.362,0.631"]
"Slave trade intensity" [exposure,pos="-0.886,0.266"]
"Spatial autocorrelation" [pos="-0.174,0.071"]
"State development" [pos="-0.033,0.566"]
"Ethnic fractionalization" -> "Modern GPD per capita"
"Historical population" -> "Ethnic fractionalization"
# Script to retrieve the characteristics of the available backends in IBM Quantum Experience
# by Jaime Sevilla, based on a script from Douglas T. McClure
# Importing standard Qiskit libraries and configuring account
from qiskit import QuantumCircuit, execute, Aer, IBMQ
from qiskit.compiler import transpile, assemble
from qiskit.tools.jupyter import *
from qiskit.visualization import *
# Loading your IBM Q account(s)
provider = IBMQ.load_account()
jsevillamol@jsevillamol-N551JK:~/Descargas/pgilinux-2019-194-x86-64$ sudo ./install
[sudo] password for jsevillamol:
Welcome to the PGI Linux installer!
You are installing PGI 2019 version 19.4 for Linux.
Please note that all Trademarks and Marks are the properties
of their respective owners.
Press enter to continue...