Skip to content

Instantly share code, notes, and snippets.

View gvdr's full-sized avatar

Giulio Valentino Dalla Riva gvdr

  • School of Mathematics and Statistics, University of Canterbury
  • Christchurch, New Zealand
View GitHub Profile
@gvdr
gvdr / proc_OSS.jl
Created April 22, 2015 21:59
Compute the ordinary Procrustes sum of squares of two matrices in Julialang. All credits to procOPA {shapes}
View proc_OSS.jl
#This is just a quick translation of an ordinary Procrustes sum of squares method, as done in the R function procOPA.
#All credits to Dryden, I. L. (2014). shapes package. R Foundation for Statistical Computing, Vienna, Austria. Contributed package. Version 1-1.10. URL http://www.R-project.org
#The function are, for now, as they are. I'll be working on them in the future...
#Compute a matrix with ones on the main diagonal
#and -1/n elsewhere
function scaled_ones(n)
eye(n) - (1/n) * ones(n,n)
end
@gvdr
gvdr / do_the_mfob
Last active December 19, 2015 02:18
A Markovian trait based fields of bullets method. Based on dendropy and random, mfob is a small module that permits a fast implementation of a fields of bullets model where the probability of extinction depends on a binary trait evolved from the root as a markov process.
View do_the_mfob
"""
Created on Fri Jun 21 10:52:11 2013
@author: Giulio Valentino Dalla Riva
@email: gvd16@uclive.ac.nz
"""
#generate a tree list following a birth and death process
#the process is conditioned to N leaves (with success)
#the list is long rang
def generate_trees_bdN(birth=0.57721,death=0.130357,N=49,rang=314):