|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.stat.Jackknife
public class Jackknife
Applies the jackknife to generic statistics.
This class applies the jackknife method (see, e.g., “A leisurely look at the bootstrap, the jackknife, and cross-validation”, by Bradley Efron and Gail Gong,
The American Statistician, 37(1):36−48, 1983) to reduce the bias in the estimation of a nonlinear
statistic of interest (linear statistics, such as the mean, pass through the jackknife without change).
The statistic must take a sample (an array of big decimals) and return
corresponding values (again as an array of big decimals). In case high-precision
arithmetic is not required, an instance of Jackknife.AbstractStatistic
just takes an array of doubles and returns an
array of doubles, handling all necessary type conversions.
The static method compute(List, Statistic, MathContext)
takes a list
of samples (arrays of doubles of the same length) and returns an instance of this class containing
estimates and standard errors for every
value computed by the statistic (estimates of the statistic are available both as
an array of big decimals and as an array of doubles,
whereas estimates of standard errors are provided in double format, only).
All computations are performed internally using BigDecimal
and a provided MathContext
.
The method compute(List, Statistic)
uses 100 decimal digits.
The identical statistic can be used to compute the (pointwise) empirical mean and standard error of a sample.
Nested Class Summary | |
---|---|
static class |
Jackknife.AbstractStatistic
An abstract statistic with a template method that accepts an array of doubles, returns an array of doubles and handles the data conversions that are necessary to call Jackknife.Statistic.compute(BigDecimal[], MathContext) . |
static interface |
Jackknife.Statistic
A statistic to be estimated using the jackknife on a set of samples. |
Field Summary | |
---|---|
BigDecimal[] |
bigEstimate
A vector of high-precision estimates for a statistic of interest. |
static MathContext |
DEFAULT_MATH_CONTEXT
The default MathContext used by compute(List, Statistic) : 100 digits and RoundingMode.HALF_EVEN . |
double[] |
estimate
A vector of estimates for a statistic of interest (obtained by invoking BigDecimal.doubleValue() on bigEstimate ). |
static Jackknife.Statistic |
IDENTITY
A statistic that returns the sample. |
double[] |
standardError
A vector of (estimates of the) standard error parallel to bigEstimate /estimate . |
Method Summary | |
---|---|
static double[] |
bigDecimalArray2DoubleArray(BigDecimal[] input)
|
static Jackknife |
compute(List<double[]> samples,
Jackknife.Statistic f)
Applies the jackknife to a statistic of interest using a list of samples using DEFAULT_MATH_CONTEXT as context. |
static Jackknife |
compute(List<double[]> samples,
Jackknife.Statistic f,
MathContext mc)
Applies the jackknife to a statistic of interest using a list of samples. |
static BigDecimal[] |
doubleArray2BigDecimalArray(double[] input)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final MathContext DEFAULT_MATH_CONTEXT
MathContext
used by compute(List, Statistic)
: 100 digits and RoundingMode.HALF_EVEN
.
public final BigDecimal[] bigEstimate
public final double[] estimate
BigDecimal.doubleValue()
on bigEstimate
).
public final double[] standardError
bigEstimate
/estimate
.
public static Jackknife.Statistic IDENTITY
Method Detail |
---|
public static double[] bigDecimalArray2DoubleArray(BigDecimal[] input)
public static BigDecimal[] doubleArray2BigDecimalArray(double[] input)
public String toString()
toString
in class Object
public static Jackknife compute(List<double[]> samples, Jackknife.Statistic f)
DEFAULT_MATH_CONTEXT
as context.
samples
- a list of samples (arrays of doubles of the same length).f
- a statistic of interest.
f
and corresponding standard errors
obtained by the jackknife on the given set of samples.public static Jackknife compute(List<double[]> samples, Jackknife.Statistic f, MathContext mc)
samples
- a list of samples (arrays of doubles of the same length).f
- a statistic of interest.mc
- the mathematical context to be used when dividing big decimals.
f
and corresponding standard errors
obtained by the jackknife on the given set of samples.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |