Spencer Lyon

Random Notes

last update:

Cloud tips

Cloud AWS Persistent notebook I have a persistent instance running. I followed this blog post to get it set up. I can connect to it via ssh -i ~/dotfiles/sglyon-mbp.pem.txt ubuntu@ec2-54-201-41-126.us-west-2.compute.amazonaws.com ipython notebook --profile=julia is running. I can connect to it from any browser by going to https://ec2-54-201-41-126.us-west-2.compute.amazonaws.com:8998 The password is lyon0409. I needed to add the IJulia all tcp security group to the instance through the AWS online management console.

Terminal Tips

Terminal Connecting via flooty This command starts a process so someone can log in to my machine: flootty --create TomTerminal --url=https://floobits.com/cc7768/ChaseTomShared --unsafe This command allows someone to log in after the command above has been entered flootty --url=https://floobits.com/cc7768/ChaseTomShared TomTerminal git I like to view diffs in Kaleidoscope. There are a few ways # This compares file/folder XXX from branch1 and branch2. git difftool branch1 branch2 XXX # This compares file/folder XXX from current working state and branch2 git difftool HEAD branch2 XXX Setting up ssh into stern machine.

Linux Tips

dpkg errors I wasn’t able to get apt-get to do anything. The problem was that my /boot partition was full. I checked that this was the problem using df -i and df -i I then iterated on the following two commands: dpkg -l linux-{image,headers}-"[0-9]*" | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e '[0-9]' | xargs sudo apt-get -y -f purge and

Julia

Tips and tricks Sometimes you want to have a reference to a variable defined within a scoped block when that block finished. To do that declare local varname as in this example from the Gadfly source: julia local xs, ys try (xs, ys) = map(toVecOrDist, (aes.x, aes.y)) catch e error("Stat.qq requires that x and y be bound to either a Distribution or to arrays of plain numbers.") end Calling C code Compiling C extensions in OSX Consider the following C file (call it pisum.

Kalman Filter The Kalman filter is a vital tool in any macro-economist’s (and more generally any modelers) toolbox. A filtering problem is loosely described by the use of a history of observed information to infer information about the history of some other unobservable variable (state). The Kalman filter is a recursive filter in the sense that if we have a best guess for the state value for the previous period, $t-1$, then the period $t$ observation in conjunction with the best guess for the state value in the previous period is sufficient to provide a best guess for the state value in this period.

Basic Idea The key idea behind the MCMC algorithms is that under certain conditions, Markov chains have a stationary distribution. If we can build a Markov chain whose stationary distribution is the distribution that we would like to sample from then it is relatively easy to get draws from this distribution by simulating lots of points and then randomly drawing from them. Metropolis-Hastings Both the Metropolis and Gibbs algorithms are special cases of the Metropolis-Hastings algorithm.