| 1 | /* |
| 2 | * YuleModel.java |
| 3 | * |
| 4 | * Copyright (c) 2002-2015 Alexei Drummond, Andrew Rambaut and Marc Suchard |
| 5 | * |
| 6 | * This file is part of BEAST. |
| 7 | * See the NOTICE file distributed with this work for additional |
| 8 | * information regarding copyright ownership and licensing. |
| 9 | * |
| 10 | * BEAST is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU Lesser General Public License as |
| 12 | * published by the Free Software Foundation; either version 2 |
| 13 | * of the License, or (at your option) any later version. |
| 14 | * |
| 15 | * BEAST is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU Lesser General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU Lesser General Public |
| 21 | * License along with BEAST; if not, write to the |
| 22 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
| 23 | * Boston, MA 02110-1301 USA |
| 24 | */ |
| 25 | |
| 26 | package dr.evomodel.speciation; |
| 27 | |
| 28 | /** |
| 29 | * From Gernhard 2008, Yule density (p; conditioned on n nodes) should be: |
| 30 | * <p/> |
| 31 | * double p = 0.0; |
| 32 | * <p/> |
| 33 | * p = lambda^(n-1) * exp(-lambda*rootHeight); |
| 34 | * <p/> |
| 35 | * for (int i = 1; i < n; i++) { |
| 36 | * p *= exp(-lambda*height[i]) |
| 37 | * } |
| 38 | * |
| 39 | * @author Alexei Drummond |
| 40 | * @author Roald Forsberg |
| 41 | */ |
| 42 | //public class YuleModel extends UltrametricSpeciationModel { |
| 43 | // |
| 44 | // |
| 45 | // |
| 46 | // |
| 47 | // public YuleModel(Parameter birthRateParameter, Type units) { |
| 48 | // |
| 49 | // super(YULE_MODEL, units); |
| 50 | // |
| 51 | // this.birthRateParameter = birthRateParameter; |
| 52 | // addVariable(birthRateParameter); |
| 53 | // birthRateParameter.addBounds(new Parameter.DefaultBounds(Double.POSITIVE_INFINITY, 0.0, 1)); |
| 54 | // } |
| 55 | // |
| 56 | // public double getBirthRate() { |
| 57 | // return birthRateParameter.getParameterValue(0); |
| 58 | // } |
| 59 | // |
| 60 | // public void setBirthRate(double birthRate) { |
| 61 | // |
| 62 | // birthRateParameter.setParameterValue(0, birthRate); |
| 63 | // } |
| 64 | // |
| 65 | // // |
| 66 | // // functions that define a speciation model |
| 67 | // // |
| 68 | // public double logTreeProbability(int taxonCount) { |
| 69 | // return 0.0; |
| 70 | // } |
| 71 | // |
| 72 | // // |
| 73 | // // functions that define a speciation model |
| 74 | // // |
| 75 | // public double logNodeProbability(Tree tree, NodeRef node) { |
| 76 | // |
| 77 | // double nodeHeight = tree.getNodeHeight(node); |
| 78 | // final double lambda = getBirthRate(); |
| 79 | // |
| 80 | // double logP = 0; |
| 81 | // |
| 82 | // |
| 83 | // if (tree.isRoot(node)) { |
| 84 | // logP += -lambda * nodeHeight; |
| 85 | // } else { |
| 86 | // } |
| 87 | // logP += Math.log(lambda); |
| 88 | // logP += -lambda * nodeHeight; |
| 89 | // |
| 90 | // return logP; |
| 91 | // } |
| 92 | // |
| 93 | // public boolean includeExternalNodesInLikelihoodCalculation() { |
| 94 | // return false; |
| 95 | // } |
| 96 | // |
| 97 | // // ************************************************************** |
| 98 | // // XMLElement IMPLEMENTATION |
| 99 | // // ************************************************************** |
| 100 | // |
| 101 | // public org.w3c.dom.Element createElement(org.w3c.dom.Document d) { |
| 102 | // throw new RuntimeException("createElement not implemented"); |
| 103 | // } |
| 104 | // |
| 105 | // |
| 106 | // //Protected stuff |
| 107 | // Parameter birthRateParameter; |
| 108 | // |
| 109 | //} |