当前位置: 首页>>代码示例>>Java>>正文


Java Distribution类代码示例

本文整理汇总了Java中dr.math.distributions.Distribution的典型用法代码示例。如果您正苦于以下问题:Java Distribution类的具体用法?Java Distribution怎么用?Java Distribution使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Distribution类属于dr.math.distributions包,在下文中一共展示了Distribution类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPriorExpectationMean

import dr.math.distributions.Distribution; //导入依赖的package包/类
public double getPriorExpectationMean() {
    double expMean = 1.0;
    Distribution dist = priorType.getDistributionInstance(this);
    if (dist != null) {
        expMean = dist.mean();

        if (expMean == 0) {
            expMean = dist.quantile(0.975);
        }

        if (expMean == 0) {
            expMean = 1.0;
        }
    }

    return expMean;
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:18,代码来源:Parameter.java

示例2: TwoPieceLocationScaleDistributionModel

import dr.math.distributions.Distribution; //导入依赖的package包/类
public TwoPieceLocationScaleDistributionModel(Parameter locationParam, Distribution distribution,
                                              Parameter sigmaParameter,
                                              Parameter gammaParameter, Parameterization parameterization) {
    super(TwoPieceLocationScaleDistributionModelParser.DISTRIBUTION_MODEL);
    this.locationParameter = locationParam;
    this.sigmaParameter = sigmaParameter;
    this.gammaParameter = gammaParameter;
    this.distribution = distribution;

    addVariable(locationParam);
    addVariable(sigmaParameter);
    addVariable(gammaParameter);

    locationParam.addBounds(new Parameter.DefaultBounds(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, 1));
    sigmaParameter.addBounds(new Parameter.DefaultBounds(Double.POSITIVE_INFINITY, 0.0, 1));
    gammaParameter.addBounds(new Parameter.DefaultBounds(Double.POSITIVE_INFINITY, 0.0, 1));

    this.parameterization = parameterization;

    // TODO Upgrade Distribution to DistributionModel
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:22,代码来源:TwoPieceLocationScaleDistributionModel.java

示例3: NormalNormalMeanGibbsOperator

import dr.math.distributions.Distribution; //导入依赖的package包/类
public NormalNormalMeanGibbsOperator(DistributionLikelihood inLikelihood, Distribution prior,
                                     double weight) {

    if (!(prior instanceof NormalDistribution || prior instanceof NormalDistributionModel))
        throw new RuntimeException("Mean prior must be Normal");

    this.likelihood = inLikelihood.getDistribution();
    this.dataList = inLikelihood.getDataList();
    if (likelihood instanceof NormalDistributionModel)
        this.meanParameter = (Parameter) ((NormalDistributionModel) likelihood).getMean();
    else if (likelihood instanceof LogNormalDistributionModel) {
        if (((LogNormalDistributionModel) likelihood).getParameterization() == LogNormalDistributionModel.Parameterization.MEAN_STDEV) {
            this.meanParameter = ((LogNormalDistributionModel) likelihood).getMeanParameter();
        } else {
            this.meanParameter = ((LogNormalDistributionModel) likelihood).getMuParameter();
        }
        isLog = true;
    } else
        throw new RuntimeException("Likelihood must be Normal or log Normal");

    this.prior = prior;
    setWeight(weight);
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:24,代码来源:NormalNormalMeanGibbsOperator.java

示例4: parseXMLObject

import dr.math.distributions.Distribution; //导入依赖的package包/类
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    DistributionLikelihood priorLikelihood = (DistributionLikelihood)xo.getElementFirstChild(PRIOR);
    DistributionLikelihood pseudoPriorLikelihood = (DistributionLikelihood)xo.getElementFirstChild(PSEUDO_PRIOR);
    Distribution prior = priorLikelihood.getDistribution();
    Distribution pseudoPrior = pseudoPriorLikelihood.getDistribution();
    Parameter modelIndicator = (Parameter)xo.getElementFirstChild(MODEL_INDICATOR);
    int[] models = xo.getIntegerArrayAttribute(MODELS);
    Parameter selectedVariable = (Parameter)xo.getElementFirstChild(SELECTED_VARIABLE);


    ModelSpecificPseudoPriorLikelihood likelihood =
            new ModelSpecificPseudoPriorLikelihood(
                    prior,
                    pseudoPrior,
                    modelIndicator,
                    models
            );
    likelihood.addData(selectedVariable);
    

    return likelihood;
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:23,代码来源:ModelSpecificPseudoPriorLikelihoodParser.java

示例5: parseXMLObject

import dr.math.distributions.Distribution; //导入依赖的package包/类
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    DistributionLikelihood priorLikelihood = (DistributionLikelihood)xo.getElementFirstChild(PRIOR);
    DistributionLikelihood pseudoPriorLikelihood = (DistributionLikelihood)xo.getElementFirstChild(PSEUDO_PRIOR);
    Distribution prior = priorLikelihood.getDistribution();
    Distribution pseudoPrior = pseudoPriorLikelihood.getDistribution();
    Parameter bitVector = (Parameter)xo.getElementFirstChild(PARAMETER_VECTOR);
    int paramIndex = xo.getIntegerAttribute(PARAMETER_INDEX);
    Parameter selectedVariable = (Parameter)xo.getElementFirstChild(SELECTED_VARIABLE);


    TwoPartsDistributionLikelihood likelihood =
            new TwoPartsDistributionLikelihood(
                    prior,
                    pseudoPrior,
                    bitVector,
                    paramIndex
            );
    likelihood.addData(selectedVariable);

    return likelihood;
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:22,代码来源:TwoPartsDistributionLikelihoodParser.java

示例6: setupChart

import dr.math.distributions.Distribution; //导入依赖的package包/类
private void setupChart() {
    for (int i = 0; i < 2; ++i) {
        chart[i].removeAllPlots();

        double offset = 0.0;
        Distribution distribution = null;
        switch (i) {
            case 0:
                distribution = optionsPanels.get(PriorType.NORMAL_PRIOR).getDistribution();
                break;
            case 1:
                distribution = optionsPanels.get(PriorType.GAMMA_PRIOR).getDistribution();
                break;
        }

        chart[i].addPlot(new PDFPlot(distribution, offset));
        if (distribution != null) {
            quantileText[i].setText(formatter.format(distribution.quantile(0.025)) +
                    "\n" + formatter.format(distribution.quantile(0.05)) +
                    "\n" + formatter.format(distribution.quantile(0.5)) +
                    "\n" + formatter.format(distribution.quantile(0.95)) +
                    "\n" + formatter.format(distribution.quantile(0.975)));
        }
    }
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:26,代码来源:HierarchicalPriorDialog.java

示例7: NormalGammaPrecisionGibbsOperator

import dr.math.distributions.Distribution; //导入依赖的package包/类
public NormalGammaPrecisionGibbsOperator(DistributionLikelihood inLikelihood, Distribution prior,
                                         double weight) {

    if (!(prior instanceof GammaDistribution || prior instanceof GammaDistributionModel))
        throw new RuntimeException("Precision prior must be Gamma");

    Distribution likelihood = inLikelihood.getDistribution();
    this.dataList = inLikelihood.getDataList();
    if (likelihood instanceof NormalDistributionModel) {
        this.precisionParameter = (Parameter) ((NormalDistributionModel) likelihood).getPrecision();
        this.meanParameter = (Parameter) ((NormalDistributionModel) likelihood).getMean();
    } else if (likelihood instanceof LogNormalDistributionModel) {
        this.precisionParameter = ((LogNormalDistributionModel) likelihood).getPrecisionParameter();
        this.meanParameter = ((LogNormalDistributionModel) likelihood).getMeanParameter();
        isLog = true;
    } else
        throw new RuntimeException("Likelihood must be Normal or log Normal");

    if (precisionParameter == null)
        throw new RuntimeException("Must characterize likelihood in terms of a precision parameter");

    this.prior = prior;
    setWeight(weight);
}
 
开发者ID:whdc,项目名称:ieo-beast,代码行数:25,代码来源:NormalGammaPrecisionGibbsOperator.java

示例8: NormalNormalMeanGibbsOperator

import dr.math.distributions.Distribution; //导入依赖的package包/类
public NormalNormalMeanGibbsOperator(DistributionLikelihood inLikelihood, Distribution prior,
                                     double weight) {

    if (!(prior instanceof NormalDistribution || prior instanceof NormalDistributionModel))
        throw new RuntimeException("Mean prior must be Normal");

    this.likelihood = inLikelihood.getDistribution();
    this.dataList = inLikelihood.getDataList();
    if (likelihood instanceof NormalDistributionModel)
        this.meanParameter = (Parameter) ((NormalDistributionModel) likelihood).getMean();
    else if (likelihood instanceof LogNormalDistributionModel) {
        this.meanParameter = ((LogNormalDistributionModel) likelihood).getMeanParameter();
        isLog = true;
    } else
        throw new RuntimeException("Likelihood must be Normal or log Normal");

    this.prior = prior;
    setWeight(weight);
}
 
开发者ID:whdc,项目名称:ieo-beast,代码行数:20,代码来源:NormalNormalMeanGibbsOperator.java

示例9: ModelSpecificPseudoPriorLikelihood

import dr.math.distributions.Distribution; //导入依赖的package包/类
public ModelSpecificPseudoPriorLikelihood(
        Distribution prior,
        Distribution pseudoPrior,
        Parameter modelIndicator,
        int[] models){
    super(prior);
    this.prior = prior;
    this.pseudoPrior = pseudoPrior;
    this.models = models;
    this.modelIndicator = modelIndicator;
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:12,代码来源:ModelSpecificPseudoPriorLikelihood.java

示例10: TwoPartsDistributionLikelihood

import dr.math.distributions.Distribution; //导入依赖的package包/类
public TwoPartsDistributionLikelihood(
        Distribution prior,
        Distribution pseudoPrior,
        Parameter bitVector,
        int paramIndex){
    super(prior);
    this.prior = distribution;
    this.pseudoPrior = pseudoPrior;
    this.bitVector = bitVector;
    this.paramIndex = paramIndex;
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:12,代码来源:TwoPartsDistributionLikelihood.java

示例11: DistributionLikelihood

import dr.math.distributions.Distribution; //导入依赖的package包/类
public DistributionLikelihood(Distribution distribution, double offset, boolean evaluateEarly, double scale) {
    super(null);
    this.distribution = distribution;
    this.offset = offset;
    this.evaluateEarly = evaluateEarly;
    this.scale=scale;
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:8,代码来源:DistributionLikelihood.java

示例12: RegressionGibbsPrecisionOperator

import dr.math.distributions.Distribution; //导入依赖的package包/类
public RegressionGibbsPrecisionOperator(LinearRegression linearModel, Parameter precision, Distribution prior) {

        super();
        if (!(prior instanceof GammaDistribution || prior instanceof GammaDistributionModel))
              throw new RuntimeException("Precision prior must be Gamma");
        this.prior = prior;
        this.linearModel = linearModel;
        this.precision = precision;
        this.dim = precision.getDimension();
        scaleDesign = linearModel.getScaleDesign();
        N = linearModel.getDependentVariable().getDimension();
    }
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:13,代码来源:RegressionGibbsPrecisionOperator.java

示例13: NormalGammaPrecisionGibbsOperator

import dr.math.distributions.Distribution; //导入依赖的package包/类
public NormalGammaPrecisionGibbsOperator(DistributionLikelihood inLikelihood, Distribution prior,
                                         double weight) {

    if (!(prior instanceof GammaDistribution || prior instanceof GammaDistributionModel))
        throw new RuntimeException("Precision prior must be Gamma");

    Distribution likelihood = inLikelihood.getDistribution();
    this.dataList = inLikelihood.getDataList();

    if (likelihood instanceof NormalDistributionModel) {
        this.precisionParameter = (Parameter) ((NormalDistributionModel) likelihood).getPrecision();
        this.meanParameter = (Parameter) ((NormalDistributionModel) likelihood).getMean();
    } else if (likelihood instanceof LogNormalDistributionModel) {
        if (((LogNormalDistributionModel) likelihood).getParameterization() == LogNormalDistributionModel.Parameterization.MU_PRECISION) {
            this.meanParameter = ((LogNormalDistributionModel) likelihood).getMuParameter();
        } else {
            throw new RuntimeException("Must characterize likelihood in terms of mu and precision parameters");
        }
        this.precisionParameter = ((LogNormalDistributionModel) likelihood).getPrecisionParameter();
        isLog = true;
    } else
        throw new RuntimeException("Likelihood must be Normal or log Normal");

    if (precisionParameter == null)
        throw new RuntimeException("Must characterize likelihood in terms of a precision parameter");

    this.prior = prior;
    setWeight(weight);
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:30,代码来源:NormalGammaPrecisionGibbsOperator.java

示例14: setupChart

import dr.math.distributions.Distribution; //导入依赖的package包/类
void setupChart() {
    chart.removeAllPlots();

    if (hasInvalidInput(false)) {
        quantileText.setText("Invalid input");
        return;
    }

    PriorType priorType = (PriorType) priorCombo.getSelectedItem();

    if (priorType == null) {
        priorType = parameter.priorType;
        priorCombo.setSelectedItem(priorType);
    }

    PriorOptionsPanel priorOptionsPanel = optionsPanels.get(priorType);

    double offset = 0.0; // TODO is this used or duplicated to OffsetPositiveDistribution?
    // this does not refresh dist from parameter truncation lower/upper, it get them from GUI
    Distribution distribution = priorOptionsPanel.getDistribution(parameter);

    chart.addPlot(new PDFPlot(distribution, offset));
    if (distribution != null) {
        quantileText.setText(formatter.format(distribution.quantile(0.025)) +
                "\n" + formatter.format(distribution.quantile(0.05)) +
                "\n" + formatter.format(distribution.quantile(0.5)) +
                "\n" + formatter.format(distribution.quantile(0.95)) +
                "\n" + formatter.format(distribution.quantile(0.975)));
    }

}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:32,代码来源:PriorSettingsPanel.java

示例15: getDistribution

import dr.math.distributions.Distribution; //导入依赖的package包/类
public Distribution getDistribution() {
    return new NormalDistribution(getValue(0), getValue(1));
}
 
开发者ID:beast-dev,项目名称:beast-mcmc,代码行数:4,代码来源:HierarchicalPriorDialog.java


注:本文中的dr.math.distributions.Distribution类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。