sudo apt-get install debootstrap schroot
CHROOT=/tmp/saucy-i386; mkdir -p $CHROOT; sudo debootstrap --arch=i386 --include=python-pandas,sudo,wget --components=main,universe,multiverse saucy $CHROOT http://debian.lcs.mit.edu/ubuntu
echo -e "[saucy-i386]\ndescription=Ubuntu saucy i386 architecture\ndirectory=$CHROOT\ntype=directory\nusers=$USER\nroot-groups=root\n" | sudo bash -c 'cat - > /etc/schroot/chroot.d/saucy-i386'
This file contains 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
export BLAS=/home/skipper/.local/lib/libopenblas.a | |
export LAPACK=/home/skipper/.local/lib/libopenblas.a | |
pip install numpy | |
pip install scipy | |
pip install nose | |
pip install patsy | |
pip install Cython | |
pip install pandas |
This file contains 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
% stochastic independence | |
\newcommand\independent{\protect\mathpalette{\protect\independenT}{\perp}} | |
\def\independenT#1#2{\mathrel{\rlap{$#1#2$}\mkern2mu{#1#2}}} | |
% conditional probability pipe | |
\mid |
This file contains 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
library(fpp) | |
data(usmelec) | |
write.csv(as.data.frame(list(date=as.Date(usmelec), usmelec=coredata(usmelec))), "usmelec.csv", row.names=FALSE) |
This file contains 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
""" | |
Frisch-Waugh-Lovell Theorem. | |
In a multiple regression, the effect of any single covariate can be obtained | |
by removing the effects of the other covariates from both the dependent and | |
independent variables. | |
""" | |
import numpy as np | |
import statsmodels.api as sm |
This file contains 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
class MonkeyOpen(pysal.IOHandlers.gal.GalIO): | |
FORMATS = ['gal'] | |
MODES = ['r', 'w'] | |
def __init__(self, *args, **kwargs): | |
self._typ = str | |
pysal.core.FileIO.FileIO.__init__(self, *args, **kwargs) | |
self.file = urlopen(self.dataPath) | |
@staticmethod | |
def getType(*args, **kwargs): |
This file contains 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
def wide_to_long(df, stubnames, i, j): | |
""" | |
User-friendly wide panel to long format. | |
Parameters | |
---------- | |
df : DataFrame | |
The wide-format DataFrame | |
stubnames : list | |
A list of stub names. The wide format variables are assumed to |
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 25 columns, instead of 12 in line 5.
This file contains 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
CUSIP,ARDSSIC,SCISECT,LOGK,SUMPAT,LOGR70,LOGR71,LOGR72,LOGR73,LOGR74,LOGR75,LOGR76,LOGR77,LOGR78,LOGR79,PAT70,PAT71,PAT72,PAT73,PAT74,PAT75,PAT76,PAT77,PAT78,PAT79 | |
800,15,0,6.08360,354.00000,0.99684,0.88311,0.94196,1.06678,1.02901,0.92327,1.02309,0.97240,1.09500,1.07624,30.00000,28.00000,22.00000,34.00000,31.00000,32.00000,41.00000,60.00000,57.00000,77.00000 | |
1030,14,1,1.97492,13.00000,-0.45815,-0.21637,0.08434,-0.15087,-0.68464,-1.48519,-1.19495,-0.60968,-0.58082,-0.60915,3.00000,1.00000,2.00000,1.00000,2.00000,3.00000,2.00000,1.00000,1.00000,1.00000 | |
2824,4,1,5.64899,493.00000,3.39054,3.40697,3.44199,3.52962,3.58542,3.67343,3.77871,3.82205,3.88021,3.90665,48.00000,43.00000,61.00000,63.00000,58.00000,49.00000,42.00000,63.00000,77.00000,80.00000 | |
4644,13,0,0.68377,2.00000,0.54340,0.48454,0.58779,0.48840,0.53714,0.43436,0.33836,0.36561,0.43860,0.42459,1.00000,0.00000,0.00000,1.00000,0.00000,0.00000,0.00000,1.00000,0.00000,0.00000 | |
7842,16,0,2.06433,12.00000,0.39511,-0.88895,-0.31471,-0.21752,-0.36157,-1.29773,-1.6 |
This file contains 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
import numpy as np | |
from scipy import special, stats | |
from statsmodels.base.model import GenericLikelihoodModel | |
def vuong_test(p1, p2): | |
r""" | |
Vuong-test for non-nested models. | |
Parameters | |
---------- |
This file contains 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 more off | |
capture program drop ZIP_FE_model | |
program define ZIP_FE_model | |
version 9.1 | |
args todo b lnf | |
tempvar theta1 lambda last nonz w sln0 sln r0 r nb0 nb1 nb00 nb2 L2 | |
local by "$MY_panel" |