Package edu.cmu.tetrad.data
Class BootstrapSampler
java.lang.Object
edu.cmu.tetrad.data.BootstrapSampler
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 -
Method Summary
Modifier and TypeMethodDescriptionbooleanThis method takes a dataset and a sample size and creates a new dataset containing that number of samples byThis 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.voidsetWithReplacement(boolean withReplacement) 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.
-
Constructor Details
-
BootstrapSampler
public BootstrapSampler()Constructs a sample that does not do any logging.
-
-
Method Details
-
sample
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 fromnewSampleSize- the number of samples to draw- Returns:
- a
DataSetobject
-
isWithReplacement
public boolean isWithReplacement()This method takes a dataset and a sample size and creates a new dataset containing that number of samples by- Returns:
- the sample size
-
setWithReplacement
public void setWithReplacement(boolean withReplacement) 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:
withReplacement- the sample size
-