Simulations
Class HypothesisTest

java.lang.Object
  extended by Simulations.HypothesisTest

public class HypothesisTest
extends java.lang.Object

Class to do hypothesis testing using simulation to generate the null distribution.

Version:
1.1

Constructor Summary
HypothesisTest(Model nullModel, Model altModel, Constrainer nullConstrainer, Constrainer altConstrainer, Optimizer o, int reps)
          Constructor for use when one or both of the null hypothesis and alternative hypothesis have constraints.
HypothesisTest(Model nullModel, Model altModel, Optimizer o, int reps)
          Constructor for use when neither the null hypothesis and alternative hypothesis have constraints.
 
Method Summary
 double test(Tree t, Alignment a, Alignment unobserved, Parameters nullParams, Parameters altParams)
          Does a hpyothesis test on the given data and gives a p-value
 double test(Tree t, Alignment a, Alignment unobserved, Parameters nullParams, Parameters altParams, java.util.Map<java.lang.String,java.lang.String> recode)
          Does a hpyothesis test on the given data and gives a p-value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HypothesisTest

public HypothesisTest(Model nullModel,
                      Model altModel,
                      Optimizer o,
                      int reps)
Constructor for use when neither the null hypothesis and alternative hypothesis have constraints.

Parameters:
nullModel - The null model
altModel - The alternative model
o - The optimizer to be used
reps - The number of samples of the null distribution to generate

HypothesisTest

public HypothesisTest(Model nullModel,
                      Model altModel,
                      Constrainer nullConstrainer,
                      Constrainer altConstrainer,
                      Optimizer o,
                      int reps)
Constructor for use when one or both of the null hypothesis and alternative hypothesis have constraints. If only one is constrained then NoConstraints should be used as input for the hypothesis that is unconstrained.

Parameters:
nullModel - The null model
altModel - The alternative model
nullConstrainer - The constrainer for the null hypothesis
altConstrainer - The constrainer for the alternative hypothesis
o - The optimizer to be used
reps - The number of samples of the null distribution to generate
Method Detail

test

public double test(Tree t,
                   Alignment a,
                   Alignment unobserved,
                   Parameters nullParams,
                   Parameters altParams)
            throws RateCategory.RateException,
                   Model.ModelException,
                   TreeException,
                   Parameters.ParameterException,
                   OutputException,
                   AlignmentException,
                   Simulate.SimulationException
Does a hpyothesis test on the given data and gives a p-value

Parameters:
t - The tree
a - The alignment
unobserved - Any unobserved states
nullParams - The paramters of the null model
altParams - The parameters of the alternative model
Returns:
A p-value
Throws:
AlignmentException - Thrown if there is a problem with the alignment
TreeException - Thrown if the constrainer has a problem with the tree
Simulate.SimulationException - Thrown if there is a problem with the simulation (currently only if attempting to simulate for a site class we don't have a model and / or constraints for)
RateCategory.RateException - Thrown if there is an issue with a rate category in the model (e.g. a badly formatted rate).
Model.ModelException - Thrown if there is a problem with the model (e.g. the rate categories differ in their states)
Parameters.ParameterException - Thrown if there is a problem with the parameters (e.g. a requied parameter is not present)
OutputException - Should not currently be thrown as would only be thrown when an optimizer try to write a checkpoint file and that isn't currently supported in this class. Included as should be in a future version.

test

public double test(Tree t,
                   Alignment a,
                   Alignment unobserved,
                   Parameters nullParams,
                   Parameters altParams,
                   java.util.Map<java.lang.String,java.lang.String> recode)
            throws RateCategory.RateException,
                   Model.ModelException,
                   TreeException,
                   Parameters.ParameterException,
                   OutputException,
                   AlignmentException,
                   Simulate.SimulationException
Does a hpyothesis test on the given data and gives a p-value

Parameters:
t - The tree
a - The alignment
unobserved - Any unobserved states
nullParams - The paramters of the null model
altParams - The parameters of the alternative model
recode - The recoding to be passed to the simulator. See Simulate.getAlignment(int, java.util.Map) for while this is neccessary.
Returns:
A p-value
Throws:
AlignmentException - Thrown if there is a problem with the alignment
TreeException - Thrown if the constrainer has a problem with the tree
Simulate.SimulationException - Thrown if there is a problem with the simulation (currently only if attempting to simulate for a site class we don't have a model and / or constraints for)
RateCategory.RateException - Thrown if there is an issue with a rate category in the model (e.g. a badly formatted rate).
Model.ModelException - Thrown if there is a problem with the model (e.g. the rate categories differ in their states)
Parameters.ParameterException - Thrown if there is a problem with the parameters (e.g. a requied parameter is not present)
OutputException - Should not currently be thrown as would only be thrown when an optimizer try to write a checkpoint file and that isn't currently supported in this class. Included as should be in a future version.