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
plot.aic <- function(fit, new=T, sd=0.1) | |
{ # code to plot AIC against order of AR model fitted | |
if (new) plot((1:length(fit$aic))-1,fit$aic,type="l",xlab="Order",ylab="AIC") else | |
lines((1:length(fit$aic))-1,fit$aic,type="l") | |
points(rnorm(1,fit$order,sd=sd),rnorm(1,sd=sd),pch=16,col="red") | |
} | |
plot.stat_ic <- function(stat, new=T, sd=0.1) | |
{ # code to plot AIC against order of AR model fitted | |
if (new) plot((1:length(stat))-1,stat,type="l",xlab="Order",ylab="AIC") else |
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
from pylab import * | |
import numpy | |
def grid_sq(fr,ncol,bs,npx=2,bval=0): | |
Z = fr.shape[0] | |
z=0 | |
vbar = bval*ones((bs[0],npx)) | |
hbar = bval*ones((npx, (bs[1] + npx)*ncol + npx)) | |
grid = [hbar] | |
row = [vbar] |
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
from pylab import * | |
import scipy.stats as stats | |
######################################################################################## | |
# | |
# QUICK ILLUSTRATION OF USING SCIPY.STATS FOR GAMMA AND INV-GAMMA | |
# HOW TO DO SHAPE-RATE (alpha, beta) PARAMETERISATION CORRECTLY | |
# | |
######################################################################################## |
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
# context: http://stackoverflow.com/questions/39448808/julia-tcp-server-and-connection | |
# Use fn to process messages from sock. | |
# Loop till sock is open and fn returns true. | |
function processor(fn, sock) | |
proc = true | |
try | |
while proc && ((nb_available(sock) > 0) || isopen(sock)) | |
proc = fn(sock) | |
end |
OlderNewer