Class BootstrapSampler

java.lang.Object
edu.cmu.tetrad.data.BootstrapSampler

public final class BootstrapSampler extends Object
Provides a static method for sampling with replacement from a dataset to create a new dataset with a sample size supplied by the user.

Since sampling is done with replacement, the output dataset can have more samples than the input.

Version:
$Id: $Id
Author:
Frank Wimberly
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a sample that does not do any logging.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    This method takes a dataset and a sample size and creates a new dataset containing that number of samples by
    sample(DataSet dataSet, int newSampleSize)
    This method takes a dataset and a sample size and creates a new dataset containing that number of samples by drawing with replacement from the original dataset.
    void
    setWithoutReplacements(boolean withoutReplacements)
    This method takes a dataset and a sample size and creates a new dataset containing that number of samples by drawing with replacement from the original dataset.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BootstrapSampler

      public BootstrapSampler()
      Constructs a sample that does not do any logging.
  • Method Details

    • sample

      public DataSet sample(DataSet dataSet, int newSampleSize)
      This method takes a dataset and a sample size and creates a new dataset containing that number of samples by drawing with replacement from the original dataset.
      Parameters:
      dataSet - the dataset to sample from
      newSampleSize - the number of samples to draw
      Returns:
      a DataSet object
    • isWithoutReplacements

      public boolean isWithoutReplacements()
      This method takes a dataset and a sample size and creates a new dataset containing that number of samples by
      Returns:
      the sample size
    • setWithoutReplacements

      public void setWithoutReplacements(boolean withoutReplacements)
      This method takes a dataset and a sample size and creates a new dataset containing that number of samples by drawing with replacement from the original dataset.
      Parameters:
      withoutReplacements - the sample size