org.statcato.statistics.inferential
Class SampleSizeDetermination
java.lang.Object
org.statcato.statistics.inferential.SampleSizeDetermination
public class SampleSizeDetermination
- extends java.lang.Object
Functions for determining the sample size estimating a population statistic.
- Since:
- 1.0
- Version:
- %I%, %G%
- Author:
- Margaret Yau
Method Summary |
static int |
mean(double alpha,
double stdev,
double error)
Returns the sample size for estimating a population mean
given the significance level, standard deviation, and margin of error. |
static int |
proportion(double alpha,
double estimate,
double error)
Returns the sample size for estimating a population proportion
given the significance level, proportion estimate, and
margin of error. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SampleSizeDetermination
public SampleSizeDetermination()
proportion
public static int proportion(double alpha,
double estimate,
double error)
- Returns the sample size for estimating a population proportion
given the significance level, proportion estimate, and
margin of error.
n = z^2 * p * q / E^2 if proportion estimate p is known
(z is the critical value based on the significance level,
E is the margin of error, and q is 1 - p.)
n = z^2 * 0.25 / E^2 if proportion estimate is unknown
- Parameters:
alpha
- significance levelestimate
- proportiion estimate (-1 if unknown)error
- margin of error
- Returns:
- sample size
mean
public static int mean(double alpha,
double stdev,
double error)
- Returns the sample size for estimating a population mean
given the significance level, standard deviation, and margin of error.
n = [z * sigma / E]^2
where z is the critical value given the significance level,
sigma is the population standard deviation, and E is the margin of error.
- Parameters:
alpha
- significance levelstdev
- population standard deviationerror
- margin of error
- Returns:
- sample size