Class PooledIndependenceWrapper
java.lang.Object
edu.cmu.tetrad.algcomparison.utils.PooledIndependenceWrapper
- All Implemented Interfaces:
IndependenceWrapper, HasParameters, TetradSerializable, Serializable
The test-side counterpart of
PooledScoreWrapper: builds the inner test on each pooled data set and combines
them with IndTestMulti using Fisher's method (default) or Tippett's method on the per-data-set p-values,
per Params.POOLED_TEST_METHOD (data sets are assumed
independent of one another, e.g. different subjects or regions). This makes constraint-based algorithms
multi-data-set in the same way IMaGES makes score-based ones: PC + Fisher Z on a list of data sets is a pooled PC.
The data model passed to getTest(DataModel, Parameters) is ignored; the data sets registered for the calling thread (set by the
bootstrap loop for each replicate) or the default list are used. Instances are transient, existing only during a
search.
- Author:
- josephramsey
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPooledIndependenceWrapper(IndependenceWrapper inner, List<DataModel> defaultDataSets) Constructs a pooled independence wrapper. -
Method Summary
Modifier and TypeMethodDescriptionReturns the data type the inner independence wrapper accepts; pooling does not change it.Returns a description of the pooled test, formed by prefixing the inner wrapper's description with "Pooled".getInner()Returns the independence wrapper that is built on each pooled data set.Returns the names of the parameters the inner independence wrapper uses.getTest(DataModel ignored, Parameters parameters) Builds one test per pooled data set and combines them into anIndTestMulti, which pools the per-data-set p-values by the method selected withmethod(Parameters)(Fisher's method by default, or Tippett's).static ResolveSepsets.Methodmethod(Parameters parameters) Returns the p-value combining method selected byParams.POOLED_TEST_METHOD.voidsetThreadDataSets(List<DataModel> dataSets) Registers the data sets to pool for tests subsequently built on the calling thread, overriding the default list.
-
Constructor Details
-
PooledIndependenceWrapper
Constructs a pooled independence wrapper.- Parameters:
inner- the independence wrapper used to build one test per pooled data set.defaultDataSets- the data sets pooled when none have been registered for the calling thread viasetThreadDataSets(List); a defensive copy is kept. All pooled data sets must have the same variables by name.- Throws:
NullPointerException- ifinneris null.IllegalArgumentException- ifdefaultDataSetsis null or empty.
-
-
Method Details
-
getTest
Builds one test per pooled data set and combines them into anIndTestMulti, which pools the per-data-set p-values by the method selected withmethod(Parameters)(Fisher's method by default, or Tippett's). The data sets used are those registered for the calling thread bysetThreadDataSets(List), or the default list given at construction if none are registered.- Specified by:
getTestin interfaceIndependenceWrapper- Parameters:
ignored- ignored; the pooled data sets are used instead of this argument.parameters- the parameters, passed through to the inner wrapper for every data set and consulted forParams.POOLED_TEST_METHOD.- Returns:
- the pooled independence test.
-
method
Returns the p-value combining method selected byParams.POOLED_TEST_METHOD. The value "tippett" (case-insensitive, surrounding whitespace ignored) selects Tippett's minimum-p method with a Sidak adjustment; any other value, or no value, selects Fisher's method. Both assume the pooled data sets are independent of one another.- Parameters:
parameters- the parameters.- Returns:
- the combining method.
-
setThreadDataSets
Registers the data sets to pool for tests subsequently built on the calling thread, overriding the default list. The registration is thread-local, so concurrent searches (e.g., bootstrap replicates run in parallel) can each pool their own resampled data sets through a single shared wrapper. Pass null to clear the registration and revert to the default list.- Parameters:
dataSets- the data sets to pool on this thread, or null to clear.
-
getInner
Returns the independence wrapper that is built on each pooled data set.- Returns:
- the inner independence wrapper.
-
getDescription
Returns a description of the pooled test, formed by prefixing the inner wrapper's description with "Pooled".- Specified by:
getDescriptionin interfaceIndependenceWrapper- Returns:
- the description.
-
getDataType
Returns the data type the inner independence wrapper accepts; pooling does not change it.- Specified by:
getDataTypein interfaceIndependenceWrapper- Returns:
- the data type of the inner independence wrapper.
-
getParameters
Returns the names of the parameters the inner independence wrapper uses. The combining method is read fromParams.POOLED_TEST_METHOD, which is not added to this list here; callers that expose it should add it themselves.- Specified by:
getParametersin interfaceHasParameters- Specified by:
getParametersin interfaceIndependenceWrapper- Returns:
- the parameter names of the inner independence wrapper.
-