xMCA¶
-
class
core.xMCA.xMCA(left, right)¶ xMCA class This class is employed to do the MCA and return assocaited results.
Define the class amd do decomposition as:
>>> mca = xMCA(leftField, rightField) >>> mca.solver()
-
covFracs(n=1)¶ Fractions of covariance explained by first n modes (FCs).
Optional arguments: n
Number of FCs to retrive. Defaults to the first FCs.Returns: FCs
Two xarray.DataArray containing the FCs.Examples: Initiate the instance:
>>> mca = xMCA(left, right)
Call the solver:
>>> mca.solver()
Retrive the first two FCs with scaling:
>>> le, re = mca.covFracs(n=2)
-
expansionCoefs(n=1, scale=True)¶ Expansion coefficients of left and right fields (PCs).
Optional arguments: scaling
Scaling of the PCs to unit variance by deviding the standard deviation of corresponding expansion coefficients. Default is True.- n
- Number of PCs to retrive. Defaults to the first PCs.
Returns: PCs
Two xarray.DataArray containing the PCs.Examples: Initiate the instance:
>>> mca = xMCA(left, right)
Call the solver:
>>> mca.solver()
Retrive the first two PCs of left and right fields with scaling:
>>> le, re = mca.expansionCoefs(n=2)
-
heterogeneousPatterns(n=1, correlating=True, statistical_test=False)¶ Sigular modes expressed as the correlation between the expansion coefficient time series (PCs) and the corresponding time series of the left or right field at each grid point.
Optional arguments: n
Number of homogeneous Patternss(HPs) to retrive. Defaults to the first HPs.- correlating
- Expressed as correlation maps. Default is True. Otherwise, expressed as regression coefficient maps.
- statistical_test
- Curry out the double tailed student-t test. Default is False. Otherwise, both left and right HPs’ p-values will be returned.
Returns: HPs
Two xarray.DataArray containing the HPs.- Ps
- Two xarray.DataArray containing the P-values.
Examples: Initiate the instance:
>>> mca = xMCA(left, right)
Call the solver:
>>> mca.solver()
Retrive the first two PCs expressed as correlations:
>>> sgs = mca.homogeneousPatterns(n=2)
-
homogeneousPatterns(n=1, correlating=True, statistical_test=False)¶ Sigular modes expressed as the correlation between the expansion coefficient time series (PCs) and the corresponding time series of the left or right field at each grid point.
Optional arguments: n
Number of homogeneous Patternss(HPs) to retrive. Defaults to the first HPs.- correlating
- Expressed as correlation maps. Default is True. Otherwise, expressed as regression coefficient maps.
- statistical_test
- Curry out the double tailed student-t test. Default is False. Otherwise, both left and right HPs’ p-values will be returned.
Returns: HPs
Two xarray.DataArray containing the HPs.- Ps
- Two xarray.DataArray containing the P-values.
Examples: Initiate the instance:
>>> mca = xMCA(left, right)
Call the solver:
>>> mca.solver()
Retrive the first two PCs expressed as correlations:
>>> sgs = mca.homogeneousPatterns(n=2)
-
patterns(n=1, scaling=True)¶ Sigular vectors of left and right fields (SVs).
Optional arguments: scaling
Scaling of the SVs by multiplying the standard deviation of corresponding expansion coefficients. Default is True.- n
- Number of SVs to retrive. Defaults to the first SVs.
Returns: SVs
Two xarray.DataArray containing the SVs. The SVs will be reshaped to the same as left and right spatial domains.Examples:
Initiate the instance:
>>> mca = xMCA(left, right)
Call the solver:
>>> mca.solver()
Retrive the first two SVs of left and right fields with scaling:
>>> lp, rp = mca.patterns(n=2)
-
sigValues(n=10)¶ Singular values of the covariance matrix between left and right field (SGs).
Optional arguments: n
Number of SGs to retrive. Defaults to the first ten SGs.Returns: SGs
Two xarray.DataArray containing the SGs.Examples: Initiate the instance:
>>> mca = xMCA(left, right)
Call the solver:
>>> mca.solver()
Retrive the first two SGs with scaling:
>>> sgs = mca.sigValues(n=2)
-
solver()¶ solver of the MCA analysis. After calling the solver, the Singular Value Decomposition is done at background, then users can call patterns, expansionCoefs, CovFrac to retrive the sigular vectors, expansition coefficients and explained covariance fractions.
Examples:
Initiate the instance:
>>> test = xMCA(left, right)
Call the solver:
>>> test.solver()
-