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


Java TDistribution类代码示例

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


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

示例1: stateChanged

import smile.stat.distribution.TDistribution; //导入依赖的package包/类
@Override
public void stateChanged(ChangeEvent e) {
    if (e.getSource() == nuSlider) {
        nu = nuSlider.getValue();
        if (nu == 0) nu = 1;

        TDistribution dist = new TDistribution(nu);

        double[][] p = new double[100][2];
        double[][] q = new double[100][2];
        for (int i = 0; i < p.length; i++) {
            p[i][0] = (i - 50) / 10.0;
            p[i][1] = dist.p(p[i][0]);
            q[i][0] = (i - 50) / 10.0;
            q[i][1] = dist.cdf(p[i][0]);
        }

        pdf.clear();
        pdf.line(p, Line.Style.SOLID, Color.BLUE);

        cdf.clear();
        cdf.line(q, Line.Style.SOLID, Color.BLUE);

        double[] data = new double[500];
        for (int i = 0; i < data.length; i++) {
            data[i] = dist.rand();
        }

        histogram.clear();
        histogram.histogram(data, 20, Color.BLUE);

        qqplot.clear();
        qqplot.add(new QQPlot(data, dist));
        canvas.repaint();
    }
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:37,代码来源:TDistributionDemo.java

示例2: TDistributionDemo

import smile.stat.distribution.TDistribution; //导入依赖的package包/类
public TDistributionDemo() {
    super(new BorderLayout());

    Hashtable<Integer, JLabel> labelTable = new Hashtable<>();
    labelTable.put(1, new JLabel(String.valueOf(1)));
    for (int i = 5; i <= 20; i += 5) {
        labelTable.put(new Integer(i), new JLabel(String.valueOf(i)));
    }

    nuSlider = new JSlider(1, 20, nu);
    nuSlider.addChangeListener(this);
    nuSlider.setLabelTable(labelTable);
    nuSlider.setMajorTickSpacing(5);
    nuSlider.setMinorTickSpacing(1);
    nuSlider.setPaintTicks(true);
    nuSlider.setPaintLabels(true);

    optionPane = new JPanel(new FlowLayout(FlowLayout.LEFT));
    optionPane.setBorder(BorderFactory.createRaisedBevelBorder());
    optionPane.add(new JLabel("Degree of Freedom:"));
    optionPane.add(nuSlider);

    add(optionPane, BorderLayout.NORTH);

    canvas = new JPanel(new GridLayout(2, 2));
    add(canvas, BorderLayout.CENTER);

    TDistribution dist = new TDistribution(nu);

    double[][] p = new double[100][2];
    double[][] q = new double[100][2];
    for (int i = 0; i < p.length; i++) {
        p[i][0] = (i - 50) / 10.0;
        p[i][1] = dist.p(p[i][0]);
        q[i][0] = (i - 50) / 10.0;
        q[i][1] = dist.cdf(p[i][0]);
    }

    pdf = LinePlot.plot(p, Line.Style.SOLID, Color.BLUE);
    pdf.setTitle("PDF");
    canvas.add(pdf);

    cdf = LinePlot.plot(q, Line.Style.SOLID, Color.BLUE);
    cdf.setTitle("CDF");
    canvas.add(cdf);

    double[] data = new double[500];
    for (int i = 0; i < data.length; i++) {
        data[i] = dist.rand();
    }

    histogram = Histogram.plot(data, 20);
    histogram.setTitle("Histogram");
    canvas.add(histogram);

    qqplot = QQPlot.plot(data, dist);
    qqplot.setTitle("Q-Q Plot");
    canvas.add(qqplot);
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:60,代码来源:TDistributionDemo.java

示例3: StudentsT

import smile.stat.distribution.TDistribution; //导入依赖的package包/类
/**
 * Create a new Student's t distribution with the given degrees of freedom.
 *
 * @param df the degrees of freedom for this distribution.
 */
public StudentsT(final int df) {
    this.dist = new TDistribution(df);
    this.df = df;
}
 
开发者ID:signaflo,项目名称:java-timeseries,代码行数:10,代码来源:StudentsT.java


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