com.datumbox.framework.core.statistics.sampling
Class StratifiedSampling
- java.lang.Object
-
- com.datumbox.framework.core.statistics.sampling.StratifiedSampling
-
public class StratifiedSampling extends java.lang.ObjectThis class provides methods which can be used for performing Stratified Sampling.
-
-
Constructor Summary
Constructors Constructor and Description StratifiedSampling()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static doublemean(TransposeDataCollection sampleDataCollection, AssociativeArray populationNh)Calculate the mean from the samplestatic AssociativeArrayoptimumSampleSize(int n, AssociativeArray populationNh, AssociativeArray populationStdh)Returns the optimum sample size per strata under Neyman Allocationstatic TransposeDataCollectionrandomSampling(TransposeDataList strataIdList, AssociativeArray nh, boolean withReplacement)Samples nh ids from each strata by using Stratified Samplingstatic doublestd(TransposeDataCollection sampleDataCollection, AssociativeArray populationNh)Calculate the standard deviation of the samplestatic doublevariance(TransposeDataCollection sampleDataCollection, AssociativeArray populationNh)Calculate the variance from the samplestatic TransposeDataCollectionweightedProbabilitySampling(AssociativeArray2D strataFrequencyTable, AssociativeArray nh, boolean withReplacement)Samples nh ids from each strata based on their Frequency Tablestatic doublexbarStd(TransposeDataCollection sampleDataCollection, AssociativeArray nh, AssociativeArray populationNh)Calculates Standard Deviation for Xbarstatic doublexbarVariance(TransposeDataCollection sampleDataCollection, AssociativeArray nh, AssociativeArray populationNh)Calculates Variance for Xbar
-
-
-
Method Detail
-
weightedProbabilitySampling
public static TransposeDataCollection weightedProbabilitySampling(AssociativeArray2D strataFrequencyTable, AssociativeArray nh, boolean withReplacement)
Samples nh ids from each strata based on their Frequency Table- Parameters:
strataFrequencyTable-nh-withReplacement-- Returns:
-
randomSampling
public static TransposeDataCollection randomSampling(TransposeDataList strataIdList, AssociativeArray nh, boolean withReplacement)
Samples nh ids from each strata by using Stratified Sampling- Parameters:
strataIdList-nh-withReplacement-- Returns:
-
mean
public static double mean(TransposeDataCollection sampleDataCollection, AssociativeArray populationNh)
Calculate the mean from the sample- Parameters:
sampleDataCollection-populationNh-- Returns:
-
variance
public static double variance(TransposeDataCollection sampleDataCollection, AssociativeArray populationNh)
Calculate the variance from the sample- Parameters:
sampleDataCollection-populationNh-- Returns:
-
std
public static double std(TransposeDataCollection sampleDataCollection, AssociativeArray populationNh)
Calculate the standard deviation of the sample- Parameters:
sampleDataCollection-populationNh-- Returns:
-
xbarVariance
public static double xbarVariance(TransposeDataCollection sampleDataCollection, AssociativeArray nh, AssociativeArray populationNh)
Calculates Variance for Xbar- Parameters:
sampleDataCollection-nh-populationNh-- Returns:
-
xbarStd
public static double xbarStd(TransposeDataCollection sampleDataCollection, AssociativeArray nh, AssociativeArray populationNh)
Calculates Standard Deviation for Xbar- Parameters:
sampleDataCollection-nh-populationNh-- Returns:
-
optimumSampleSize
public static AssociativeArray optimumSampleSize(int n, AssociativeArray populationNh, AssociativeArray populationStdh)
Returns the optimum sample size per strata under Neyman Allocation- Parameters:
n-populationNh-populationStdh-- Returns:
-
-
DataMelt 3.0 © DataMelt by jWork.ORG