diff --git a/src/cr/cube/cubepart.py b/src/cr/cube/cubepart.py index c6b768ae1..f8c2c2f49 100644 --- a/src/cr/cube/cubepart.py +++ b/src/cr/cube/cubepart.py @@ -69,6 +69,11 @@ def cube_index(self): def cube_is_mr_by_itself(self): return False + @lazyproperty + def cube_row_dimension_type(self): + """Member of `cr.cube.enum.DIMENSION_TYPE` for cube row dimension""" + return self._cube.dimensions[0].dimension_type + @lazyproperty def dimension_types(self): """Sequence of member of `cr.cube.enum.DIMENSION_TYPE` for each dimension. diff --git a/src/cr/cube/matrix.py b/src/cr/cube/matrix.py index 9f9ee7bec..b22d4e640 100644 --- a/src/cr/cube/matrix.py +++ b/src/cr/cube/matrix.py @@ -876,12 +876,19 @@ class _MrXMrMatrix(_MatrixWithMR): """ def __init__( - self, dimensions, counts, base_counts, counts_with_missings, overlaps=None + self, + dimensions, + counts, + base_counts, + counts_with_missings, + overlaps=None, + overlaps_margin=None, ): super(_MrXMrMatrix, self).__init__( dimensions, counts, base_counts, counts_with_missings ) self._overlaps = overlaps + self._overlaps_margin = overlaps_margin @lazyproperty def columns(self): @@ -948,24 +955,27 @@ def tstats_overlap(self): """ # Subtraction of the proportions foreach observation - diff = np.subtract.outer( - self._mr_shadow_proportions.diagonal(), - self._mr_shadow_proportions.diagonal(), + diff = ( + np.subtract.outer( + self._mr_shadow_proportions.diagonal(), + self._mr_shadow_proportions.diagonal(), + ) + * -1 ) se_pi_pj = np.add.outer( self._mr_shadow_proportions.diagonal() * (1 - self._mr_shadow_proportions.diagonal()) - / self._pairwise_overlap_total.diagonal(), + / self._overlaps_margin.diagonal(), self._mr_shadow_proportions.diagonal() * (1 - self._mr_shadow_proportions.diagonal()) - / self._pairwise_overlap_total.diagonal(), + / self._overlaps_margin.diagonal(), ) # Correction factor considering the overlap correction_factor = ( 2 - * self._pairwise_overlap_total + * self._overlaps_margin * ( self._mr_shadow_proportions - np.multiply.outer( @@ -974,8 +984,7 @@ def tstats_overlap(self): ) ) ) / np.multiply.outer( - self._pairwise_overlap_total.diagonal(), - self._pairwise_overlap_total.diagonal(), + self._overlaps_margin.diagonal(), self._overlaps_margin.diagonal() ) se_diff = np.sqrt(se_pi_pj - correction_factor) np.fill_diagonal(diff, 0) @@ -1018,17 +1027,7 @@ def _mr_shadow_proportions(self): element of any prepended dimensions: A 1d interface to a 4d hypercube of underlying counts. """ - return self._counts[:, 0, :, 0] / self._pairwise_overlap_total - - @lazyproperty - def _pairwise_overlap_total(self): - """Return 2D ndarray symmetric-square matrix of valid observations. - - Given a 4d hypercube of multiple response items, return the - symmetric square matrix of valid observations between all pairs. - n1 = 2; n2 = 2; n12 = 1; overlap total = 3 - """ - return np.sum(self._counts, axis=(1, 3)) + return self._counts[:, 0, :, 0] / self._overlaps_margin @lazyproperty def _row_generator(self): diff --git a/src/cr/cube/util.py b/src/cr/cube/util.py index 9f603438b..96b7b4ca0 100644 --- a/src/cr/cube/util.py +++ b/src/cr/cube/util.py @@ -30,7 +30,19 @@ def calculate_overlap_tstats( if offset != 0 else mr_counts_with_missings[slice_index] ) - overlap_slice = cls(mr_dimensions, counts, base_counts, counts_with_missings) + overlap_margins = ( + np.sum(mr_counts[slice_index], axis=0)[:, 0, :, 0] + if offset != 0 + else np.sum(mr_counts, axis=0)[:, 0, :, 0] + ) + overlap_slice = cls( + mr_dimensions, + counts, + base_counts, + counts_with_missings, + None, + overlap_margins, + ) diff, se_diff = overlap_slice.tstats_overlap numerator[slice_index] = diff standard_error[slice_index] = se_diff diff --git a/tests/expectations/cat-x-mr-aug-pw-idxs-alt.py b/tests/expectations/cat-x-mr-aug-pw-idxs-alt.py index 4398a6e66..ae6d629b6 100644 --- a/tests/expectations/cat-x-mr-aug-pw-idxs-alt.py +++ b/tests/expectations/cat-x-mr-aug-pw-idxs-alt.py @@ -1,6 +1,6 @@ ( - ((2, 4), (2, 4), (4,), (2, 4), ()), - ((1, 2, 3, 4), (2, 4), (), (2, 4), ()), - ((1, 2, 3, 4), (2, 4), (), (2, 4), ()), - ((1, 2, 3, 4), (2, 4), (), (2, 4), ()), + ((1, 2, 3), (), (), (), (1, 2, 3)), + ((), (), (1, 3, 4), (), (3,)), + ((), (0, 4), (4,), (0,), ()), + ((), (0, 2, 4), (4,), (0, 2, 4), ()), ) diff --git a/tests/expectations/cat-x-mr-aug-pw-idxs-recip.py b/tests/expectations/cat-x-mr-aug-pw-idxs-recip.py index 1d4315d0a..d8e6f73f0 100644 --- a/tests/expectations/cat-x-mr-aug-pw-idxs-recip.py +++ b/tests/expectations/cat-x-mr-aug-pw-idxs-recip.py @@ -1,6 +1,6 @@ ( - ((2, 4), (2, 4), (0, 1, 3, 4), (2, 4), (0, 1, 2, 3)), - ((1, 2, 4), (0, 2, 4), (0, 1, 3), (2, 4), (0, 1, 3)), - ((1, 2, 3, 4), (0, 2, 4), (0, 1, 3), (0, 2, 4), (0, 1, 3)), - ((1, 2, 3, 4), (0, 2, 4), (0, 1, 3), (0, 2, 4), (0, 1, 3)), + ((1, 2, 3), (0,), (0, 4), (0, 4), (2, 3)), + ((), (2,), (1, 3), (2,), ()), + ((), (), (), (), ()), + ((1, 3), (0, 4), (3,), (0, 2, 4), (1, 3)), ) diff --git a/tests/expectations/cat-x-mr-aug-pw-idxs.py b/tests/expectations/cat-x-mr-aug-pw-idxs.py index 35865e691..b2bdebd5d 100644 --- a/tests/expectations/cat-x-mr-aug-pw-idxs.py +++ b/tests/expectations/cat-x-mr-aug-pw-idxs.py @@ -1,6 +1,6 @@ ( - ((2, 4), (2, 4), (4,), (2, 4), ()), - ((1, 2, 4), (2, 4), (), (2, 4), ()), - ((1, 2, 3, 4), (2, 4), (), (2, 4), ()), - ((1, 2, 3, 4), (2, 4), (), (2, 4), ()), + ((1, 2, 3), (), (), (), (2, 3)), + ((), (), (1, 3), (), ()), + ((), (), (), (), ()), + ((), (0, 4), (), (0, 2, 4), ()), ) diff --git a/tests/fixtures/cat-hs-x-mr-itself.json b/tests/fixtures/cat-hs-x-mr-augmented.json similarity index 100% rename from tests/fixtures/cat-hs-x-mr-itself.json rename to tests/fixtures/cat-hs-x-mr-augmented.json diff --git a/tests/fixtures/cat-subvar-x-mr-augmented.json b/tests/fixtures/cat-subvar-x-mr-augmented.json new file mode 100644 index 000000000..6ab709d81 --- /dev/null +++ b/tests/fixtures/cat-subvar-x-mr-augmented.json @@ -0,0 +1,947 @@ +{ + "element": "shoji:view", + "self": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/cube/?query=%7B%22dimensions%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F519304a0c6324316a05d8653575293b2%2Fsubvariables%2F00001%2F%22%7D,%7B%22function%22:%22dimension%22,%22args%22:%5B%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D,%7B%22value%22:%22subvariables%22%7D%5D%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D,%7B%22function%22:%22dimension%22,%22args%22:%5B%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D,%7B%22value%22:%22subvariables%22%7D%5D%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D%5D,%22measures%22:%7B%22count%22:%7B%22function%22:%22cube_count%22,%22args%22:%5B%5D%7D%7D,%22weight%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F0yADwLRARYg8QMoiERXLx300011d%2F%22%7D", + "value": { + "query": { + "measures": { + "count": { + "function": "cube_count", + "args": [] + } + }, + "dimensions": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/519304a0c6324316a05d8653575293b2/subvariables/00001/" + }, + { + "function": "dimension", + "args": [ + { + "function": "as_selected", + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ] + }, + { + "value": "subvariables" + } + ] + }, + { + "function": "as_selected", + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ] + }, + { + "function": "dimension", + "args": [ + { + "function": "as_selected", + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ] + }, + { + "value": "subvariables" + } + ] + }, + { + "function": "as_selected", + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ] + } + ], + "weight": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/0yADwLRARYg8QMoiERXLx300011d/" + }, + "query_environment": { + "filter": [] + }, + "result": { + "dimensions": [ + { + "references": { + "alias": "KNOWPARTIES_b_W57__1", + "name": "Increasing taxes" + }, + "derived": false, + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "id": 0, + "name": "Other", + "missing": false + }, + { + "numeric_value": null, + "id": -1, + "name": "No Data", + "missing": true + } + ] + } + }, + { + "references": { + "uniform_basis": false, + "description": null, + "format": { + "summary": { + "digits": 0 + } + }, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "notes": null, + "api_derivation": null, + "dichotomous": true, + "alias": "Trust", + "view": { + "show_counts": false, + "include_noneoftheabove": false, + "include_missing": false, + "column_width": null + }, + "name": "Trust" + }, + "derived": true, + "type": { + "subtype": { + "class": "variable" + }, + "elements": [ + { + "id": 1, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + "id": "00000" + }, + "missing": false + }, + { + "id": 2, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + "id": "00002" + }, + "missing": false + }, + { + "id": 3, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + }, + "id": "00001" + }, + "missing": false + } + ], + "class": "enum" + } + }, + { + "derived": true, + "references": { + "uniform_basis": false, + "description": null, + "name": "Trust", + "format": { + "summary": { + "digits": 0 + } + }, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "notes": null, + "api_derivation": null, + "dichotomous": true, + "alias": "Trust", + "view": { + "show_counts": false, + "include_noneoftheabove": false, + "include_missing": false, + "column_width": null + } + }, + "type": { + "ordinal": false, + "subvariables": [ + "00000", + "00002", + "00001" + ], + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + { + "references": { + "uniform_basis": false, + "description": null, + "format": { + "summary": { + "digits": 0 + } + }, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "notes": null, + "api_derivation": null, + "dichotomous": true, + "alias": "Trust", + "view": { + "show_counts": false, + "include_noneoftheabove": false, + "include_missing": false, + "column_width": null + }, + "name": "Trust" + }, + "derived": true, + "type": { + "subtype": { + "class": "variable" + }, + "elements": [ + { + "id": 1, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + "id": "00000" + }, + "missing": false + }, + { + "id": 2, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + "id": "00002" + }, + "missing": false + }, + { + "id": 3, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + }, + "id": "00001" + }, + "missing": false + } + ], + "class": "enum" + } + }, + { + "derived": true, + "references": { + "uniform_basis": false, + "description": null, + "name": "Trust", + "format": { + "summary": { + "digits": 0 + } + }, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "notes": null, + "api_derivation": null, + "dichotomous": true, + "alias": "Trust", + "view": { + "show_counts": false, + "include_noneoftheabove": false, + "include_missing": false, + "column_width": null + } + }, + "type": { + "ordinal": false, + "subvariables": [ + "00000", + "00002", + "00001" + ], + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + } + ], + "missing": 0, + "measures": { + "count": { + "data": [ + 3463.892577872864, + 0, + 0, + 2646.7341674907043, + 817.1584103821615, + 0, + 589.8272763930723, + 2874.0653014797867, + 0, + 0, + 5240.548677632821, + 0, + 472.27257430366546, + 4768.276103329146, + 0, + 2655.052324985961, + 2585.4963526468764, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2646.7341674907043, + 472.27257430366546, + 0, + 3119.0067417943724, + 0, + 0, + 528.7644489981124, + 2590.2422927962575, + 0, + 817.1584103821615, + 4768.276103329146, + 0, + 0, + 5585.43451371131, + 0, + 2716.1151523809235, + 2869.319361330401, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 589.8272763930723, + 2655.052324985961, + 0, + 528.7644489981124, + 2716.1151523809235, + 0, + 3244.879601379037, + 0, + 0, + 2874.0653014797867, + 2585.4963526468764, + 0, + 2590.2422927962575, + 2869.319361330401, + 0, + 0, + 5459.561654126631, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 724.2440963902744, + 0, + 0, + 399.6531812493329, + 324.59091514094115, + 0, + 457.9330031888786, + 266.31109320139575, + 0, + 0, + 2614.3151323535144, + 0, + 109.76172944859509, + 2504.5534029049213, + 0, + 1430.9522070403475, + 1183.3629253131694, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 399.6531812493329, + 109.76172944859509, + 0, + 509.41491069792835, + 0, + 0, + 330.9453797307386, + 178.4695309671894, + 0, + 324.59091514094115, + 2504.5534029049213, + 0, + 0, + 2829.1443180458605, + 0, + 1557.9398304984857, + 1271.2044875473734, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 457.9330031888786, + 1430.9522070403475, + 0, + 330.9453797307386, + 1557.9398304984857, + 0, + 1888.8852102292237, + 0, + 0, + 266.31109320139575, + 1183.3629253131694, + 0, + 178.4695309671894, + 1271.2044875473734, + 0, + 0, + 1449.6740185145632, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "n_missing": 0, + "metadata": { + "references": {}, + "derived": true, + "type": { + "integer": false, + "missing_rules": {}, + "missing_reasons": { + "No Data": -1 + }, + "class": "numeric" + } + } + } + }, + "n": 12043, + "filter_stats": { + "filtered_complete": { + "unweighted": { + "selected": 12043, + "other": 0, + "missing": 0 + }, + "weighted": { + "selected": 12043.000484249482, + "other": 0, + "missing": 0 + } + }, + "filtered": { + "unweighted": { + "selected": 12043, + "other": 0, + "missing": 0 + }, + "weighted": { + "selected": 12043.000484249482, + "other": 0, + "missing": 0 + } + } + }, + "unfiltered": { + "unweighted_n": 12043, + "weighted_n": 12043.000484249482 + }, + "filtered": { + "unweighted_n": 12043, + "weighted_n": 12043.000484249482 + }, + "counts": [ + 4535, + 0, + 0, + 3574, + 961, + 0, + 593, + 3942, + 0, + 0, + 5266, + 0, + 518, + 4748, + 0, + 2706, + 2560, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3574, + 518, + 0, + 4092, + 0, + 0, + 530, + 3562, + 0, + 961, + 4748, + 0, + 0, + 5709, + 0, + 2769, + 2940, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 593, + 2706, + 0, + 530, + 2769, + 0, + 3299, + 0, + 0, + 3942, + 2560, + 0, + 3562, + 2940, + 0, + 0, + 6502, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 539, + 0, + 0, + 317, + 222, + 0, + 296, + 243, + 0, + 0, + 1703, + 0, + 92, + 1611, + 0, + 870, + 833, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 317, + 92, + 0, + 409, + 0, + 0, + 231, + 178, + 0, + 222, + 1611, + 0, + 0, + 1833, + 0, + 935, + 898, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 296, + 870, + 0, + 231, + 935, + 0, + 1166, + 0, + 0, + 243, + 833, + 0, + 178, + 898, + 0, + 0, + 1076, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "element": "crunch:cube" + } + } +} \ No newline at end of file diff --git a/tests/fixtures/cat-subvar-x-mr-itself.json b/tests/fixtures/cat-subvar-x-mr-itself.json deleted file mode 100644 index ec05d8487..000000000 --- a/tests/fixtures/cat-subvar-x-mr-itself.json +++ /dev/null @@ -1,1224 +0,0 @@ -{ - "element": "shoji:view", - "self": "https://alpha.crunch.io/api/datasets/387a3d0d0c0d40068431b157ec3d21fe/cube/?query=%7B%22dimensions%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F387a3d0d0c0d40068431b157ec3d21fe%2Fvariables%2F000865%2Fsubvariables%2F0001%2F%22%7D,%7B%22function%22:%22dimension%22,%22args%22:%5B%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F387a3d0d0c0d40068431b157ec3d21fe%2Fvariables%2F000221%2F%22%7D%5D%7D,%7B%22value%22:%22subvariables%22%7D%5D%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F387a3d0d0c0d40068431b157ec3d21fe%2Fvariables%2F000221%2F%22%7D%5D%7D,%7B%22function%22:%22dimension%22,%22args%22:%5B%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F387a3d0d0c0d40068431b157ec3d21fe%2Fvariables%2F000221%2F%22%7D%5D%7D,%7B%22value%22:%22subvariables%22%7D%5D%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F387a3d0d0c0d40068431b157ec3d21fe%2Fvariables%2F000221%2F%22%7D%5D%7D%5D,%22measures%22:%7B%22count%22:%7B%22function%22:%22cube_count%22,%22args%22:%5B%5D%7D%7D,%22weight%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F387a3d0d0c0d40068431b157ec3d21fe%2Fvariables%2F98d1d04f0be3416db8016d654b11973b%2F%22%7D", - "value": { - "query": { - "measures": { - "count": { - "function": "cube_count", - "args": [] - } - }, - "dimensions": [ - { - "variable": "https://alpha.crunch.io/api/datasets/387a3d0d0c0d40068431b157ec3d21fe/variables/000865/subvariables/0001/" - }, - { - "function": "dimension", - "args": [ - { - "function": "as_selected", - "args": [ - { - "variable": "https://alpha.crunch.io/api/datasets/387a3d0d0c0d40068431b157ec3d21fe/variables/000221/" - } - ] - }, - { - "value": "subvariables" - } - ] - }, - { - "function": "as_selected", - "args": [ - { - "variable": "https://alpha.crunch.io/api/datasets/387a3d0d0c0d40068431b157ec3d21fe/variables/000221/" - } - ] - }, - { - "function": "dimension", - "args": [ - { - "function": "as_selected", - "args": [ - { - "variable": "https://alpha.crunch.io/api/datasets/387a3d0d0c0d40068431b157ec3d21fe/variables/000221/" - } - ] - }, - { - "value": "subvariables" - } - ] - }, - { - "function": "as_selected", - "args": [ - { - "variable": "https://alpha.crunch.io/api/datasets/387a3d0d0c0d40068431b157ec3d21fe/variables/000221/" - } - ] - } - ], - "weight": "https://alpha.crunch.io/api/datasets/387a3d0d0c0d40068431b157ec3d21fe/variables/98d1d04f0be3416db8016d654b11973b/" - }, - "query_environment": { - "filter": [] - }, - "result": { - "dimensions": [ - { - "references": { - "alias": "milstat_1", - "name": "Military Household - I am" - }, - "derived": false, - "type": { - "ordinal": false, - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "selected": true, - "id": 1, - "missing": false, - "name": "selected" - }, - { - "numeric_value": 2, - "selected": false, - "id": 2, - "missing": false, - "name": "not selected" - }, - { - "numeric_value": null, - "missing": true, - "id": 32767, - "name": "not asked" - }, - { - "numeric_value": null, - "missing": true, - "id": 32766, - "name": "skipped" - }, - { - "numeric_value": null, - "missing": true, - "id": -1, - "name": "No Data" - } - ] - } - }, - { - "references": { - "alias": "union_hhold", - "subreferences": [ - { - "alias": "union_hhold_1", - "name": "Yes, I am" - }, - { - "alias": "union_hhold_2", - "name": "Yes, household member is" - }, - { - "alias": "union_hhold_3", - "name": "No" - } - ], - "description": "Are you or is someone in your household a member of a labor union?", - "name": "Union Household" - }, - "derived": true, - "type": { - "subtype": { - "class": "variable" - }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "union_hhold_1", - "name": "Yes, I am" - }, - "id": "0001" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "union_hhold_2", - "name": "Yes, household member is" - }, - "id": "0002" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "union_hhold_3", - "name": "No" - }, - "id": "0003" - }, - "missing": false - } - ], - "class": "enum" - } - }, - { - "derived": true, - "references": { - "alias": "union_hhold", - "description": "Are you or is someone in your household a member of a labor union?", - "name": "Union Household", - "subreferences": [ - { - "alias": "union_hhold_1", - "name": "Yes, I am" - }, - { - "alias": "union_hhold_2", - "name": "Yes, household member is" - }, - { - "alias": "union_hhold_3", - "name": "No" - } - ] - }, - "type": { - "ordinal": false, - "subvariables": [ - "0001", - "0002", - "0003" - ], - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "selected": true, - "id": 1, - "missing": false, - "name": "Selected" - }, - { - "numeric_value": 0, - "missing": false, - "id": 0, - "name": "Other" - }, - { - "numeric_value": null, - "missing": true, - "id": -1, - "name": "No Data" - } - ] - } - }, - { - "references": { - "alias": "union_hhold", - "subreferences": [ - { - "alias": "union_hhold_1", - "name": "Yes, I am" - }, - { - "alias": "union_hhold_2", - "name": "Yes, household member is" - }, - { - "alias": "union_hhold_3", - "name": "No" - } - ], - "description": "Are you or is someone in your household a member of a labor union?", - "name": "Union Household" - }, - "derived": true, - "type": { - "subtype": { - "class": "variable" - }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "union_hhold_1", - "name": "Yes, I am" - }, - "id": "0001" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "union_hhold_2", - "name": "Yes, household member is" - }, - "id": "0002" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "union_hhold_3", - "name": "No" - }, - "id": "0003" - }, - "missing": false - } - ], - "class": "enum" - } - }, - { - "derived": true, - "references": { - "alias": "union_hhold", - "description": "Are you or is someone in your household a member of a labor union?", - "name": "Union Household", - "subreferences": [ - { - "alias": "union_hhold_1", - "name": "Yes, I am" - }, - { - "alias": "union_hhold_2", - "name": "Yes, household member is" - }, - { - "alias": "union_hhold_3", - "name": "No" - } - ] - }, - "type": { - "ordinal": false, - "subvariables": [ - "0001", - "0002", - "0003" - ], - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "selected": true, - "id": 1, - "missing": false, - "name": "Selected" - }, - { - "numeric_value": 0, - "missing": false, - "id": 0, - "name": "Other" - }, - { - "numeric_value": null, - "missing": true, - "id": -1, - "name": "No Data" - } - ] - } - } - ], - "missing": 0, - "measures": { - "count": { - "data": [ - 3.352871617403984, - 0.0, - 0.0, - 0.0, - 3.352871617403984, - 0.0, - 0.0, - 3.352871617403984, - 0.0, - 0.0, - 16.73431762470768, - 0.0, - 6.53222712627504, - 10.202090498432637, - 0.0, - 10.202090498432637, - 6.53222712627504, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 6.53222712627504, - 0.0, - 6.53222712627504, - 0.0, - 0.0, - 0.0, - 6.53222712627504, - 0.0, - 3.352871617403984, - 10.202090498432637, - 0.0, - 0.0, - 13.554962115836622, - 0.0, - 10.202090498432637, - 3.352871617403984, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 10.202090498432637, - 0.0, - 0.0, - 10.202090498432637, - 0.0, - 10.202090498432637, - 0.0, - 0.0, - 3.352871617403984, - 6.53222712627504, - 0.0, - 6.53222712627504, - 3.352871617403984, - 0.0, - 0.0, - 9.885098743679023, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 86.98306046162037, - 0.0, - 0.0, - 8.467434010700346, - 78.51562645092001, - 0.0, - 0.0, - 86.98306046162037, - 0.0, - 0.0, - 1392.9297502962697, - 0.0, - 93.46218202435382, - 1299.4675682719153, - 0.0, - 1288.4994336794884, - 104.43031661678077, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 8.467434010700346, - 93.46218202435382, - 0.0, - 101.92961603505412, - 0.0, - 0.0, - 0.0, - 101.92961603505412, - 0.0, - 78.51562645092001, - 1299.4675682719153, - 0.0, - 0.0, - 1377.9831947228358, - 0.0, - 1288.4994336794884, - 89.48376104334696, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 1288.4994336794884, - 0.0, - 0.0, - 1288.4994336794884, - 0.0, - 1288.4994336794884, - 0.0, - 0.0, - 86.98306046162037, - 104.43031661678077, - 0.0, - 101.92961603505412, - 89.48376104334696, - 0.0, - 0.0, - 191.41337707840108, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - "n_missing": 0, - "metadata": { - "references": {}, - "derived": true, - "type": { - "integer": false, - "missing_rules": {}, - "missing_reasons": { - "No Data": -1 - }, - "class": "numeric" - } - } - } - }, - "n": 1500, - "filter_stats": { - "filtered_complete": { - "unweighted": { - "selected": 1500, - "other": 0, - "missing": 431 - }, - "weighted": { - "selected": 1500.0000000000014, - "other": 0.0, - "missing": 0.0 - } - }, - "filtered": { - "unweighted": { - "selected": 1500, - "other": 431, - "missing": 0 - }, - "weighted": { - "selected": 1500.0000000000014, - "other": 0.0, - "missing": 0.0 - } - } - }, - "unfiltered": { - "unweighted_n": 1931, - "weighted_n": 1500.0000000000014 - }, - "filtered": { - "unweighted_n": 1500, - "weighted_n": 1500.0000000000014 - }, - "counts": [ - 5, - 0, - 0, - 0, - 5, - 0, - 0, - 5, - 0, - 0, - 9, - 0, - 1, - 8, - 0, - 8, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 5, - 8, - 0, - 0, - 13, - 0, - 8, - 5, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 8, - 0, - 0, - 8, - 0, - 8, - 0, - 0, - 5, - 1, - 0, - 1, - 5, - 0, - 0, - 6, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 121, - 0, - 0, - 11, - 110, - 0, - 0, - 121, - 0, - 0, - 1365, - 0, - 91, - 1274, - 0, - 1270, - 95, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 11, - 91, - 0, - 102, - 0, - 0, - 0, - 102, - 0, - 110, - 1274, - 0, - 0, - 1384, - 0, - 1270, - 114, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1270, - 0, - 0, - 1270, - 0, - 1270, - 0, - 0, - 121, - 95, - 0, - 102, - 114, - 0, - 0, - 216, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "element": "crunch:cube" - } - } -} \ No newline at end of file diff --git a/tests/fixtures/cat-x-mr-weighted-augmented.json b/tests/fixtures/cat-x-mr-weighted-augmented.json new file mode 100644 index 000000000..b4dd1143a --- /dev/null +++ b/tests/fixtures/cat-x-mr-weighted-augmented.json @@ -0,0 +1,953 @@ +{ + "element": "shoji:view", + "self": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/cube/?query=%7B%22dimensions%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2Fcbb9bb2421024e09a89b8739cb58e4fb%2Fsubvariables%2F00000%2F%22%7D,%7B%22function%22:%22dimension%22,%22args%22:%5B%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D,%7B%22value%22:%22subvariables%22%7D%5D%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D,%7B%22function%22:%22dimension%22,%22args%22:%5B%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D,%7B%22value%22:%22subvariables%22%7D%5D%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D%5D,%22measures%22:%7B%22count%22:%7B%22function%22:%22cube_count%22,%22args%22:%5B%5D%7D%7D,%22weight%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F0yADwLRARYg8QMoiERXLx300011d%2F%22%7D", + "value": { + "query": { + "measures": { + "count": { + "function": "cube_count", + "args": [] + } + }, + "dimensions": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/cbb9bb2421024e09a89b8739cb58e4fb/subvariables/00000/" + }, + { + "function": "dimension", + "args": [ + { + "function": "as_selected", + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ] + }, + { + "value": "subvariables" + } + ] + }, + { + "function": "as_selected", + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ] + }, + { + "function": "dimension", + "args": [ + { + "function": "as_selected", + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ] + }, + { + "value": "subvariables" + } + ] + }, + { + "function": "as_selected", + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ] + } + ], + "weight": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/0yADwLRARYg8QMoiERXLx300011d/" + }, + "query_environment": { + "filter": [] + }, + "result": { + "dimensions": [ + { + "references": { + "alias": "SENCONTR_W57__1", + "name": "Senate", + "view": { + "show_counts": false, + "include_noneoftheabove": false, + "include_missing": false, + "column_width": null + } + }, + "derived": false, + "type": { + "ordinal": false, + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "id": 0, + "name": "Other", + "missing": false + }, + { + "numeric_value": null, + "id": -1, + "name": "No Data", + "missing": true + } + ] + } + }, + { + "references": { + "uniform_basis": false, + "description": null, + "format": { + "summary": { + "digits": 0 + } + }, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "notes": null, + "api_derivation": null, + "dichotomous": true, + "alias": "Trust", + "view": { + "show_counts": false, + "include_noneoftheabove": false, + "include_missing": false, + "column_width": null + }, + "name": "Trust" + }, + "derived": true, + "type": { + "subtype": { + "class": "variable" + }, + "elements": [ + { + "id": 1, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + "id": "00000" + }, + "missing": false + }, + { + "id": 2, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + "id": "00002" + }, + "missing": false + }, + { + "id": 3, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + }, + "id": "00001" + }, + "missing": false + } + ], + "class": "enum" + } + }, + { + "derived": true, + "references": { + "uniform_basis": false, + "description": null, + "name": "Trust", + "format": { + "summary": { + "digits": 0 + } + }, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "notes": null, + "api_derivation": null, + "dichotomous": true, + "alias": "Trust", + "view": { + "show_counts": false, + "include_noneoftheabove": false, + "include_missing": false, + "column_width": null + } + }, + "type": { + "ordinal": false, + "subvariables": [ + "00000", + "00002", + "00001" + ], + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + { + "references": { + "uniform_basis": false, + "description": null, + "format": { + "summary": { + "digits": 0 + } + }, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "notes": null, + "api_derivation": null, + "dichotomous": true, + "alias": "Trust", + "view": { + "show_counts": false, + "include_noneoftheabove": false, + "include_missing": false, + "column_width": null + }, + "name": "Trust" + }, + "derived": true, + "type": { + "subtype": { + "class": "variable" + }, + "elements": [ + { + "id": 1, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + "id": "00000" + }, + "missing": false + }, + { + "id": 2, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + "id": "00002" + }, + "missing": false + }, + { + "id": 3, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + }, + "id": "00001" + }, + "missing": false + } + ], + "class": "enum" + } + }, + { + "derived": true, + "references": { + "uniform_basis": false, + "description": null, + "name": "Trust", + "format": { + "summary": { + "digits": 0 + } + }, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "notes": null, + "api_derivation": null, + "dichotomous": true, + "alias": "Trust", + "view": { + "show_counts": false, + "include_noneoftheabove": false, + "include_missing": false, + "column_width": null + } + }, + "type": { + "ordinal": false, + "subvariables": [ + "00000", + "00002", + "00001" + ], + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + } + ], + "missing": 0, + "measures": { + "count": { + "data": [ + 2990.034858481553, + 0, + 0, + 2309.003533193423, + 681.0313252881257, + 0, + 460.7612656136308, + 2529.273592867921, + 0, + 0, + 4417.96127005564, + 0, + 404.9396547795978, + 4013.0216152760568, + 0, + 2387.2073365798865, + 2030.7539334757605, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2309.003533193423, + 404.9396547795978, + 0, + 2713.9431879730273, + 0, + 0, + 427.73688024091933, + 2286.2063077321036, + 0, + 681.0313252881257, + 4013.0216152760568, + 0, + 0, + 4694.052940564154, + 0, + 2420.2317219526017, + 2273.8212186115857, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 460.7612656136308, + 2387.2073365798865, + 0, + 427.73688024091933, + 2420.2317219526017, + 0, + 2847.9686021935213, + 0, + 0, + 2529.273592867921, + 2030.7539334757605, + 0, + 2286.2063077321036, + 2273.8212186115857, + 0, + 0, + 4560.02752634365, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1198.1018157815818, + 0, + 0, + 737.3838155466077, + 460.71800023497684, + 0, + 586.9990139683207, + 611.1028018132641, + 0, + 0, + 3436.9025399306934, + 0, + 177.09464897266272, + 3259.8078909580317, + 0, + 1698.7971954464244, + 1738.1053444842785, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 737.3838155466077, + 177.09464897266272, + 0, + 914.4784645192702, + 0, + 0, + 431.97294848793115, + 482.50551603133994, + 0, + 460.71800023497684, + 3259.8078909580317, + 0, + 0, + 3720.525891193006, + 0, + 1853.8232609268125, + 1866.7026302662023, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 586.9990139683207, + 1698.7971954464244, + 0, + 431.97294848793115, + 1853.8232609268125, + 0, + 2285.796209414744, + 0, + 0, + 611.1028018132641, + 1738.1053444842785, + 0, + 482.50551603133994, + 1866.7026302662023, + 0, + 0, + 2349.2081462975384, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "n_missing": 0, + "metadata": { + "references": {}, + "derived": true, + "type": { + "integer": false, + "missing_rules": {}, + "missing_reasons": { + "No Data": -1 + }, + "class": "numeric" + } + } + } + }, + "n": 12043, + "filter_stats": { + "filtered_complete": { + "unweighted": { + "selected": 12043, + "other": 0, + "missing": 0 + }, + "weighted": { + "selected": 12043.000484249482, + "other": 0, + "missing": 0 + } + }, + "filtered": { + "unweighted": { + "selected": 12043, + "other": 0, + "missing": 0 + }, + "weighted": { + "selected": 12043.000484249482, + "other": 0, + "missing": 0 + } + } + }, + "unfiltered": { + "unweighted_n": 12043, + "weighted_n": 12043.000484249482 + }, + "filtered": { + "unweighted_n": 12043, + "weighted_n": 12043.000484249482 + }, + "counts": [ + 4046, + 0, + 0, + 3232, + 814, + 0, + 470, + 3576, + 0, + 0, + 4573, + 0, + 462, + 4111, + 0, + 2465, + 2108, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3232, + 462, + 0, + 3694, + 0, + 0, + 434, + 3260, + 0, + 814, + 4111, + 0, + 0, + 4925, + 0, + 2501, + 2424, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 470, + 2465, + 0, + 434, + 2501, + 0, + 2935, + 0, + 0, + 3576, + 2108, + 0, + 3260, + 2424, + 0, + 0, + 5684, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1028, + 0, + 0, + 659, + 369, + 0, + 419, + 609, + 0, + 0, + 2396, + 0, + 148, + 2248, + 0, + 1111, + 1285, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 659, + 148, + 0, + 807, + 0, + 0, + 327, + 480, + 0, + 369, + 2248, + 0, + 0, + 2617, + 0, + 1203, + 1414, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 419, + 1111, + 0, + 327, + 1203, + 0, + 1530, + 0, + 0, + 609, + 1285, + 0, + 480, + 1414, + 0, + 0, + 1894, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "element": "crunch:cube" + } + } +} \ No newline at end of file diff --git a/tests/fixtures/cat2-x-mr-itself.json b/tests/fixtures/cat2-x-mr-itself.json deleted file mode 100644 index 573ce8fc2..000000000 --- a/tests/fixtures/cat2-x-mr-itself.json +++ /dev/null @@ -1,1223 +0,0 @@ -{ - "element": "shoji:view", - "self": "https://alpha.crunch.io/api/datasets/387a3d0d0c0d40068431b157ec3d21fe/cube/?query=%7B%22dimensions%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F387a3d0d0c0d40068431b157ec3d21fe%2Fvariables%2F000463%2F%22%7D,%7B%22function%22:%22dimension%22,%22args%22:%5B%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F387a3d0d0c0d40068431b157ec3d21fe%2Fvariables%2F000221%2F%22%7D%5D%7D,%7B%22value%22:%22subvariables%22%7D%5D%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F387a3d0d0c0d40068431b157ec3d21fe%2Fvariables%2F000221%2F%22%7D%5D%7D,%7B%22function%22:%22dimension%22,%22args%22:%5B%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F387a3d0d0c0d40068431b157ec3d21fe%2Fvariables%2F000221%2F%22%7D%5D%7D,%7B%22value%22:%22subvariables%22%7D%5D%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F387a3d0d0c0d40068431b157ec3d21fe%2Fvariables%2F000221%2F%22%7D%5D%7D%5D,%22measures%22:%7B%22count%22:%7B%22function%22:%22cube_count%22,%22args%22:%5B%5D%7D%7D,%22weight%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2F387a3d0d0c0d40068431b157ec3d21fe%2Fvariables%2F98d1d04f0be3416db8016d654b11973b%2F%22%7D", - "value": { - "query": { - "measures": { - "count": { - "function": "cube_count", - "args": [] - } - }, - "dimensions": [ - { - "variable": "https://alpha.crunch.io/api/datasets/387a3d0d0c0d40068431b157ec3d21fe/variables/000463/" - }, - { - "function": "dimension", - "args": [ - { - "function": "as_selected", - "args": [ - { - "variable": "https://alpha.crunch.io/api/datasets/387a3d0d0c0d40068431b157ec3d21fe/variables/000221/" - } - ] - }, - { - "value": "subvariables" - } - ] - }, - { - "function": "as_selected", - "args": [ - { - "variable": "https://alpha.crunch.io/api/datasets/387a3d0d0c0d40068431b157ec3d21fe/variables/000221/" - } - ] - }, - { - "function": "dimension", - "args": [ - { - "function": "as_selected", - "args": [ - { - "variable": "https://alpha.crunch.io/api/datasets/387a3d0d0c0d40068431b157ec3d21fe/variables/000221/" - } - ] - }, - { - "value": "subvariables" - } - ] - }, - { - "function": "as_selected", - "args": [ - { - "variable": "https://alpha.crunch.io/api/datasets/387a3d0d0c0d40068431b157ec3d21fe/variables/000221/" - } - ] - } - ], - "weight": "https://alpha.crunch.io/api/datasets/387a3d0d0c0d40068431b157ec3d21fe/variables/98d1d04f0be3416db8016d654b11973b/" - }, - "query_environment": { - "filter": [] - }, - "result": { - "dimensions": [ - { - "references": { - "alias": "pew_bornagain", - "name": "Born Again", - "description": "Would you describe yourself as a born-again or evangelical Christian, or not?" - }, - "derived": false, - "type": { - "ordinal": false, - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "id": 1, - "name": "Yes", - "missing": false - }, - { - "numeric_value": 2, - "id": 2, - "name": "No", - "missing": false - }, - { - "numeric_value": null, - "id": 32767, - "name": "not asked", - "missing": true - }, - { - "numeric_value": null, - "id": 32766, - "name": "skipped", - "missing": true - }, - { - "numeric_value": null, - "id": -1, - "name": "No Data", - "missing": true - } - ] - } - }, - { - "references": { - "alias": "union_hhold", - "subreferences": [ - { - "alias": "union_hhold_1", - "name": "Yes, I am" - }, - { - "alias": "union_hhold_2", - "name": "Yes, household member is" - }, - { - "alias": "union_hhold_3", - "name": "No" - } - ], - "description": "Are you or is someone in your household a member of a labor union?", - "name": "Union Household" - }, - "derived": true, - "type": { - "subtype": { - "class": "variable" - }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "union_hhold_1", - "name": "Yes, I am" - }, - "id": "0001" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "union_hhold_2", - "name": "Yes, household member is" - }, - "id": "0002" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "union_hhold_3", - "name": "No" - }, - "id": "0003" - }, - "missing": false - } - ], - "class": "enum" - } - }, - { - "derived": true, - "references": { - "alias": "union_hhold", - "description": "Are you or is someone in your household a member of a labor union?", - "name": "Union Household", - "subreferences": [ - { - "alias": "union_hhold_1", - "name": "Yes, I am" - }, - { - "alias": "union_hhold_2", - "name": "Yes, household member is" - }, - { - "alias": "union_hhold_3", - "name": "No" - } - ] - }, - "type": { - "ordinal": false, - "subvariables": [ - "0001", - "0002", - "0003" - ], - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "selected": true, - "id": 1, - "missing": false, - "name": "Selected" - }, - { - "numeric_value": 0, - "missing": false, - "id": 0, - "name": "Other" - }, - { - "numeric_value": null, - "missing": true, - "id": -1, - "name": "No Data" - } - ] - } - }, - { - "references": { - "alias": "union_hhold", - "subreferences": [ - { - "alias": "union_hhold_1", - "name": "Yes, I am" - }, - { - "alias": "union_hhold_2", - "name": "Yes, household member is" - }, - { - "alias": "union_hhold_3", - "name": "No" - } - ], - "description": "Are you or is someone in your household a member of a labor union?", - "name": "Union Household" - }, - "derived": true, - "type": { - "subtype": { - "class": "variable" - }, - "elements": [ - { - "id": 1, - "value": { - "derived": false, - "references": { - "alias": "union_hhold_1", - "name": "Yes, I am" - }, - "id": "0001" - }, - "missing": false - }, - { - "id": 2, - "value": { - "derived": false, - "references": { - "alias": "union_hhold_2", - "name": "Yes, household member is" - }, - "id": "0002" - }, - "missing": false - }, - { - "id": 3, - "value": { - "derived": false, - "references": { - "alias": "union_hhold_3", - "name": "No" - }, - "id": "0003" - }, - "missing": false - } - ], - "class": "enum" - } - }, - { - "derived": true, - "references": { - "alias": "union_hhold", - "description": "Are you or is someone in your household a member of a labor union?", - "name": "Union Household", - "subreferences": [ - { - "alias": "union_hhold_1", - "name": "Yes, I am" - }, - { - "alias": "union_hhold_2", - "name": "Yes, household member is" - }, - { - "alias": "union_hhold_3", - "name": "No" - } - ] - }, - "type": { - "ordinal": false, - "subvariables": [ - "0001", - "0002", - "0003" - ], - "class": "categorical", - "categories": [ - { - "numeric_value": 1, - "selected": true, - "id": 1, - "missing": false, - "name": "Selected" - }, - { - "numeric_value": 0, - "missing": false, - "id": 0, - "name": "Other" - }, - { - "numeric_value": null, - "missing": true, - "id": -1, - "name": "No Data" - } - ] - } - } - ], - "missing": 4, - "measures": { - "count": { - "data": [ - 27.412851015427925, - 0.0, - 0.0, - 4.406001781465532, - 23.006849233962395, - 0.0, - 0.0, - 27.412851015427925, - 0.0, - 0.0, - 408.83262647946975, - 0.0, - 16.074699368603156, - 392.75792711086666, - 0.0, - 392.75792711086666, - 16.074699368603156, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 4.406001781465532, - 16.074699368603156, - 0.0, - 20.480701150068693, - 0.0, - 0.0, - 0.0, - 20.480701150068693, - 0.0, - 23.006849233962395, - 392.75792711086666, - 0.0, - 0.0, - 415.7647763448292, - 0.0, - 392.75792711086666, - 23.006849233962395, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 392.75792711086666, - 0.0, - 0.0, - 392.75792711086666, - 0.0, - 392.75792711086666, - 0.0, - 0.0, - 27.412851015427925, - 16.074699368603156, - 0.0, - 20.480701150068693, - 23.006849233962395, - 0.0, - 0.0, - 43.487550384031074, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 62.923081063596406, - 0.0, - 0.0, - 4.061432229234814, - 58.861648834361596, - 0.0, - 0.0, - 62.923081063596406, - 0.0, - 0.0, - 993.9703356167447, - 0.0, - 82.0358104663888, - 911.9345251503556, - 0.0, - 904.6331595247511, - 89.33717609199341, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 4.061432229234814, - 82.0358104663888, - 0.0, - 86.0972426956236, - 0.0, - 0.0, - 0.0, - 86.0972426956236, - 0.0, - 58.861648834361596, - 911.9345251503556, - 0.0, - 0.0, - 970.7961739847173, - 0.0, - 904.6331595247511, - 66.16301445996622, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 904.6331595247511, - 0.0, - 0.0, - 904.6331595247511, - 0.0, - 904.6331595247511, - 0.0, - 0.0, - 62.923081063596406, - 89.33717609199341, - 0.0, - 86.0972426956236, - 66.16301445996622, - 0.0, - 0.0, - 152.2602571555897, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 6.861105824761237, - 0.0, - 1.88389931563693, - 4.977206509124307, - 0.0, - 1.310437542301957, - 5.55066828245928, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 1.88389931563693, - 0.0, - 1.88389931563693, - 0.0, - 0.0, - 0.0, - 1.88389931563693, - 0.0, - 0.0, - 4.977206509124307, - 0.0, - 0.0, - 4.977206509124307, - 0.0, - 1.310437542301957, - 3.66676896682235, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 1.310437542301957, - 0.0, - 0.0, - 1.310437542301957, - 0.0, - 1.310437542301957, - 0.0, - 0.0, - 0.0, - 5.55066828245928, - 0.0, - 1.88389931563693, - 3.66676896682235, - 0.0, - 0.0, - 5.55066828245928, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0, - 0.0 - ], - "n_missing": 4, - "metadata": { - "references": {}, - "derived": true, - "type": { - "integer": false, - "missing_rules": {}, - "missing_reasons": { - "No Data": -1 - }, - "class": "numeric" - } - } - } - }, - "n": 1500, - "filter_stats": { - "filtered_complete": { - "unweighted": { - "selected": 1500, - "other": 0, - "missing": 431 - }, - "weighted": { - "selected": 1500.0000000000014, - "other": 0.0, - "missing": 0.0 - } - }, - "filtered": { - "unweighted": { - "selected": 1500, - "other": 431, - "missing": 0 - }, - "weighted": { - "selected": 1500.0000000000014, - "other": 0.0, - "missing": 0.0 - } - } - }, - "unfiltered": { - "unweighted_n": 1931, - "weighted_n": 1500.0000000000014 - }, - "filtered": { - "unweighted_n": 1500, - "weighted_n": 1500.0000000000014 - }, - "counts": [ - 36, - 0, - 0, - 6, - 30, - 0, - 0, - 36, - 0, - 0, - 412, - 0, - 19, - 393, - 0, - 393, - 19, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 6, - 19, - 0, - 25, - 0, - 0, - 0, - 25, - 0, - 30, - 393, - 0, - 0, - 423, - 0, - 393, - 30, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 393, - 0, - 0, - 393, - 0, - 393, - 0, - 0, - 36, - 19, - 0, - 25, - 30, - 0, - 0, - 55, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 90, - 0, - 0, - 5, - 85, - 0, - 0, - 90, - 0, - 0, - 958, - 0, - 72, - 886, - 0, - 883, - 75, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 5, - 72, - 0, - 77, - 0, - 0, - 0, - 77, - 0, - 85, - 886, - 0, - 0, - 971, - 0, - 883, - 88, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 883, - 0, - 0, - 883, - 0, - 883, - 0, - 0, - 90, - 75, - 0, - 77, - 88, - 0, - 0, - 165, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 4, - 0, - 1, - 3, - 0, - 2, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 0, - 1, - 0, - 0, - 3, - 0, - 0, - 3, - 0, - 2, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 2, - 0, - 0, - 2, - 0, - 2, - 0, - 0, - 0, - 2, - 0, - 1, - 1, - 0, - 0, - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "element": "crunch:cube" - } - } -} \ No newline at end of file diff --git a/tests/fixtures/mr-x-mr-itself.json b/tests/fixtures/mr-x-mr-augmented.json similarity index 100% rename from tests/fixtures/mr-x-mr-itself.json rename to tests/fixtures/mr-x-mr-augmented.json diff --git a/tests/fixtures/mr-x-mr-weighted-augmented.json b/tests/fixtures/mr-x-mr-weighted-augmented.json new file mode 100644 index 000000000..4bdf0e8d2 --- /dev/null +++ b/tests/fixtures/mr-x-mr-weighted-augmented.json @@ -0,0 +1,3070 @@ +{ + "element": "shoji:view", + "self": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/cube/?query=%7B%22dimensions%22:%5B%7B%22function%22:%22dimension%22,%22args%22:%5B%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2Fcbb9bb2421024e09a89b8739cb58e4fb%2F%22%7D%5D%7D,%7B%22value%22:%22subvariables%22%7D%5D%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2Fcbb9bb2421024e09a89b8739cb58e4fb%2F%22%7D%5D%7D,%7B%22function%22:%22dimension%22,%22args%22:%5B%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D,%7B%22value%22:%22subvariables%22%7D%5D%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D,%7B%22function%22:%22dimension%22,%22args%22:%5B%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D,%7B%22value%22:%22subvariables%22%7D%5D%7D,%7B%22function%22:%22as_selected%22,%22args%22:%5B%7B%22variable%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F13aa1c88f30d4d3d9fbe27349b050f17%2F%22%7D%5D%7D%5D,%22measures%22:%7B%22count%22:%7B%22function%22:%22cube_count%22,%22args%22:%5B%5D%7D%7D,%22weight%22:%22https:%2F%2Falpha.crunch.io%2Fapi%2Fdatasets%2Ff6d04137cce547e8acbd46b8d0d66f13%2Fvariables%2F0yADwLRARYg8QMoiERXLx300011d%2F%22%7D", + "value": { + "query": { + "measures": { + "count": { + "function": "cube_count", + "args": [] + } + }, + "dimensions": [ + { + "function": "dimension", + "args": [ + { + "function": "as_selected", + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/cbb9bb2421024e09a89b8739cb58e4fb/" + } + ] + }, + { + "value": "subvariables" + } + ] + }, + { + "function": "as_selected", + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/cbb9bb2421024e09a89b8739cb58e4fb/" + } + ] + }, + { + "function": "dimension", + "args": [ + { + "function": "as_selected", + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ] + }, + { + "value": "subvariables" + } + ] + }, + { + "function": "as_selected", + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ] + }, + { + "function": "dimension", + "args": [ + { + "function": "as_selected", + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ] + }, + { + "value": "subvariables" + } + ] + }, + { + "function": "as_selected", + "args": [ + { + "variable": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/13aa1c88f30d4d3d9fbe27349b050f17/" + } + ] + } + ], + "weight": "https://alpha.crunch.io/api/datasets/f6d04137cce547e8acbd46b8d0d66f13/variables/0yADwLRARYg8QMoiERXLx300011d/" + }, + "query_environment": { + "filter": [] + }, + "result": { + "dimensions": [ + { + "references": { + "uniform_basis": false, + "description": null, + "name": "Pol.Know", + "format": { + "summary": { + "digits": 0 + } + }, + "subreferences": [ + { + "alias": "SENCONTR_W57__1", + "name": "Senate" + }, + { + "alias": "KNOWDEFICIT_W57__1", + "name": "Deficit" + }, + { + "alias": "KNOWUNEMPLY_W57__1", + "name": "Unemp." + }, + { + "alias": "KNOWTARIFF_W57__1", + "name": "Tariffs" + }, + { + "alias": "ELECTKNOW2_W57__1", + "name": "Elec.vote" + } + ], + "notes": null, + "api_derivation": null, + "dichotomous": true, + "alias": "Political Knowledge", + "view": { + "show_counts": false, + "include_noneoftheabove": false, + "include_missing": false, + "column_width": null + } + }, + "derived": true, + "type": { + "subtype": { + "class": "variable" + }, + "elements": [ + { + "id": 1, + "value": { + "derived": false, + "references": { + "alias": "SENCONTR_W57__1", + "name": "Senate" + }, + "id": "00000" + }, + "missing": false + }, + { + "id": 2, + "value": { + "derived": false, + "references": { + "alias": "KNOWDEFICIT_W57__1", + "name": "Deficit" + }, + "id": "00001" + }, + "missing": false + }, + { + "id": 3, + "value": { + "derived": false, + "references": { + "alias": "KNOWUNEMPLY_W57__1", + "name": "Unemp." + }, + "id": "00002" + }, + "missing": false + }, + { + "id": 4, + "value": { + "derived": false, + "references": { + "alias": "KNOWTARIFF_W57__1", + "name": "Tariffs" + }, + "id": "00003" + }, + "missing": false + }, + { + "id": 5, + "value": { + "derived": false, + "references": { + "alias": "ELECTKNOW2_W57__1", + "name": "Elec.vote" + }, + "id": "00004" + }, + "missing": false + } + ], + "class": "enum" + } + }, + { + "derived": true, + "references": { + "uniform_basis": false, + "description": null, + "format": { + "summary": { + "digits": 0 + } + }, + "subreferences": [ + { + "alias": "SENCONTR_W57__1", + "name": "Senate" + }, + { + "alias": "KNOWDEFICIT_W57__1", + "name": "Deficit" + }, + { + "alias": "KNOWUNEMPLY_W57__1", + "name": "Unemp." + }, + { + "alias": "KNOWTARIFF_W57__1", + "name": "Tariffs" + }, + { + "alias": "ELECTKNOW2_W57__1", + "name": "Elec.vote" + } + ], + "notes": null, + "api_derivation": null, + "dichotomous": true, + "alias": "Political Knowledge", + "view": { + "show_counts": false, + "include_noneoftheabove": false, + "include_missing": false, + "column_width": null + }, + "name": "Pol.Know" + }, + "type": { + "ordinal": false, + "subvariables": [ + "00000", + "00001", + "00002", + "00003", + "00004" + ], + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + { + "references": { + "uniform_basis": false, + "description": null, + "format": { + "summary": { + "digits": 0 + } + }, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "notes": null, + "api_derivation": null, + "dichotomous": true, + "alias": "Trust", + "view": { + "show_counts": false, + "include_noneoftheabove": false, + "include_missing": false, + "column_width": null + }, + "name": "Trust" + }, + "derived": true, + "type": { + "subtype": { + "class": "variable" + }, + "elements": [ + { + "id": 1, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + "id": "00000" + }, + "missing": false + }, + { + "id": 2, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + "id": "00002" + }, + "missing": false + }, + { + "id": 3, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + }, + "id": "00001" + }, + "missing": false + } + ], + "class": "enum" + } + }, + { + "derived": true, + "references": { + "uniform_basis": false, + "description": null, + "name": "Trust", + "format": { + "summary": { + "digits": 0 + } + }, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "notes": null, + "api_derivation": null, + "dichotomous": true, + "alias": "Trust", + "view": { + "show_counts": false, + "include_noneoftheabove": false, + "include_missing": false, + "column_width": null + } + }, + "type": { + "ordinal": false, + "subvariables": [ + "00000", + "00002", + "00001" + ], + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + }, + { + "references": { + "uniform_basis": false, + "description": null, + "format": { + "summary": { + "digits": 0 + } + }, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "notes": null, + "api_derivation": null, + "dichotomous": true, + "alias": "Trust", + "view": { + "show_counts": false, + "include_noneoftheabove": false, + "include_missing": false, + "column_width": null + }, + "name": "Trust" + }, + "derived": true, + "type": { + "subtype": { + "class": "variable" + }, + "elements": [ + { + "id": 1, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + "id": "00000" + }, + "missing": false + }, + { + "id": 2, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + "id": "00002" + }, + "missing": false + }, + { + "id": 3, + "value": { + "derived": false, + "references": { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + }, + "id": "00001" + }, + "missing": false + } + ], + "class": "enum" + } + }, + { + "derived": true, + "references": { + "uniform_basis": false, + "description": null, + "name": "Trust", + "format": { + "summary": { + "digits": 0 + } + }, + "subreferences": [ + { + "alias": "CR_SOURCESUM_NYTimes__1", + "name": "NYTimes" + }, + { + "alias": "CR_SOURCESUM_WashingtonPost__1", + "name": "WaPo" + }, + { + "alias": "CR_SOURCESUM_FoxNews__1", + "name": "FoxNews" + } + ], + "notes": null, + "api_derivation": null, + "dichotomous": true, + "alias": "Trust", + "view": { + "show_counts": false, + "include_noneoftheabove": false, + "include_missing": false, + "column_width": null + } + }, + "type": { + "ordinal": false, + "subvariables": [ + "00000", + "00002", + "00001" + ], + "class": "categorical", + "categories": [ + { + "numeric_value": 1, + "selected": true, + "id": 1, + "missing": false, + "name": "Selected" + }, + { + "numeric_value": 0, + "missing": false, + "id": 0, + "name": "Other" + }, + { + "numeric_value": null, + "missing": true, + "id": -1, + "name": "No Data" + } + ] + } + } + ], + "missing": 0, + "measures": { + "count": { + "data": [ + 2990.034858481553, + 0, + 0, + 2309.003533193423, + 681.0313252881257, + 0, + 460.7612656136308, + 2529.273592867921, + 0, + 0, + 4417.96127005564, + 0, + 404.9396547795978, + 4013.0216152760568, + 0, + 2387.2073365798865, + 2030.7539334757605, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2309.003533193423, + 404.9396547795978, + 0, + 2713.9431879730273, + 0, + 0, + 427.73688024091933, + 2286.2063077321036, + 0, + 681.0313252881257, + 4013.0216152760568, + 0, + 0, + 4694.052940564154, + 0, + 2420.2317219526017, + 2273.8212186115857, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 460.7612656136308, + 2387.2073365798865, + 0, + 427.73688024091933, + 2420.2317219526017, + 0, + 2847.9686021935213, + 0, + 0, + 2529.273592867921, + 2030.7539334757605, + 0, + 2286.2063077321036, + 2273.8212186115857, + 0, + 0, + 4560.02752634365, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1198.1018157815818, + 0, + 0, + 737.3838155466077, + 460.71800023497684, + 0, + 586.9990139683207, + 611.1028018132641, + 0, + 0, + 3436.9025399306934, + 0, + 177.09464897266272, + 3259.8078909580317, + 0, + 1698.7971954464244, + 1738.1053444842785, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 737.3838155466077, + 177.09464897266272, + 0, + 914.4784645192702, + 0, + 0, + 431.97294848793115, + 482.50551603133994, + 0, + 460.71800023497684, + 3259.8078909580317, + 0, + 0, + 3720.525891193006, + 0, + 1853.8232609268125, + 1866.7026302662023, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 586.9990139683207, + 1698.7971954464244, + 0, + 431.97294848793115, + 1853.8232609268125, + 0, + 2285.796209414744, + 0, + 0, + 611.1028018132641, + 1738.1053444842785, + 0, + 482.50551603133994, + 1866.7026302662023, + 0, + 0, + 2349.2081462975384, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2837.445136419887, + 0, + 0, + 2245.047762054548, + 592.3973743653349, + 0, + 406.9553204622253, + 2430.4898159576587, + 0, + 0, + 3827.3178541996117, + 0, + 388.5300998005305, + 3438.787754399078, + 0, + 1898.729474167008, + 1928.5883800326005, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2245.047762054548, + 388.5300998005305, + 0, + 2633.577861855085, + 0, + 0, + 366.84168624134816, + 2266.736175613731, + 0, + 592.3973743653349, + 3438.787754399078, + 0, + 0, + 4031.1851287644104, + 0, + 1938.8431083878845, + 2092.3420203765327, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 406.9553204622253, + 1898.729474167008, + 0, + 366.84168624134816, + 1938.8431083878845, + 0, + 2305.6847946292355, + 0, + 0, + 2430.4898159576587, + 1928.5883800326005, + 0, + 2266.736175613731, + 2092.3420203765327, + 0, + 0, + 4359.078195990237, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1350.691537843249, + 0, + 0, + 801.3395866854862, + 549.3519511577676, + 0, + 640.8049591197256, + 709.8865787235287, + 0, + 0, + 4027.545955786735, + 0, + 193.50420395172995, + 3834.041751835006, + 0, + 2187.2750578593023, + 1840.270897927437, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 801.3395866854862, + 193.50420395172995, + 0, + 994.8437906372159, + 0, + 0, + 492.86814248750267, + 501.97564814971435, + 0, + 549.3519511577676, + 3834.041751835006, + 0, + 0, + 4383.393702992753, + 0, + 2335.211874491525, + 2048.181828501249, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 640.8049591197256, + 2187.2750578593023, + 0, + 492.86814248750267, + 2335.211874491525, + 0, + 2828.0800169790236, + 0, + 0, + 709.8865787235287, + 1840.270897927437, + 0, + 501.97564814971435, + 2048.181828501249, + 0, + 0, + 2550.157476650968, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2626.083250479717, + 0, + 0, + 2002.4359716704325, + 623.6472788092722, + 0, + 586.5782249779999, + 2039.5050255017056, + 0, + 0, + 5180.554854259442, + 0, + 393.6071348978369, + 4786.947719361604, + 0, + 2916.508127136274, + 2264.0467271231896, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2002.4359716704325, + 393.6071348978369, + 0, + 2396.0431065682783, + 0, + 0, + 530.8199519926698, + 1865.2231545756008, + 0, + 623.6472788092722, + 4786.947719361604, + 0, + 0, + 5410.5949981708645, + 0, + 2972.2664001216085, + 2438.3285980492938, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 586.5782249779999, + 2916.508127136274, + 0, + 530.8199519926698, + 2972.2664001216085, + 0, + 3503.086352114278, + 0, + 0, + 2039.5050255017056, + 2264.0467271231896, + 0, + 1865.2231545756008, + 2438.3285980492938, + 0, + 0, + 4303.551752624868, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1562.0534237834163, + 0, + 0, + 1043.9513770695921, + 518.1020467138301, + 0, + 461.18205460395126, + 1100.87136917947, + 0, + 0, + 2674.308955726884, + 0, + 188.42716885442346, + 2485.8817868724636, + 0, + 1169.496404890036, + 1504.8125508368516, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1043.9513770695921, + 188.42716885442346, + 0, + 1232.3785459240125, + 0, + 0, + 328.8898767361809, + 903.4886691878362, + 0, + 518.1020467138301, + 2485.8817868724636, + 0, + 0, + 3003.9838335862887, + 0, + 1301.7885827578043, + 1702.1952508284871, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 461.18205460395126, + 1169.496404890036, + 0, + 328.8898767361809, + 1301.7885827578043, + 0, + 1630.678459493985, + 0, + 0, + 1100.87136917947, + 1504.8125508368516, + 0, + 903.4886691878362, + 1702.1952508284871, + 0, + 0, + 2605.683920016327, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3370.049234061513, + 0, + 0, + 2558.289095470916, + 811.7601385906001, + 0, + 608.5846872850881, + 2761.464546776423, + 0, + 0, + 5278.543917052562, + 0, + 475.42953021898876, + 4803.114386833571, + 0, + 2703.9767136739333, + 2574.567203378635, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2558.289095470916, + 475.42953021898876, + 0, + 3033.7186256899035, + 0, + 0, + 557.7609547480055, + 2475.957670941898, + 0, + 811.7601385906001, + 4803.114386833571, + 0, + 0, + 5614.874525424161, + 0, + 2754.8004462110184, + 2860.0740792131587, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 608.5846872850881, + 2703.9767136739333, + 0, + 557.7609547480055, + 2754.8004462110184, + 0, + 3312.5614009590254, + 0, + 0, + 2761.464546776423, + 2574.567203378635, + 0, + 2475.957670941898, + 2860.0740792131587, + 0, + 0, + 5336.031750155033, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 818.0874402016248, + 0, + 0, + 488.0982532691229, + 329.98918693250255, + 0, + 439.1755922968632, + 378.9118479047623, + 0, + 0, + 2576.31989293378, + 0, + 106.60477353327202, + 2469.7151194005096, + 0, + 1382.0278183523733, + 1194.2920745814035, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 488.0982532691229, + 106.60477353327202, + 0, + 594.7030268023941, + 0, + 0, + 301.9488739808453, + 292.7541528215492, + 0, + 329.98918693250255, + 2469.7151194005096, + 0, + 0, + 2799.7043063330084, + 0, + 1519.2545366683885, + 1280.449769664616, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 439.1755922968632, + 1382.0278183523733, + 0, + 301.9488739808453, + 1519.2545366683885, + 0, + 1821.2034106492324, + 0, + 0, + 378.9118479047623, + 1194.2920745814035, + 0, + 292.7541528215492, + 1280.449769664616, + 0, + 0, + 1573.2039224861646, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1822.675605371199, + 0, + 0, + 1373.346482535572, + 449.32912283562945, + 0, + 346.506527064608, + 1476.1690783065937, + 0, + 0, + 2883.9924334449283, + 0, + 243.35844277436388, + 2640.63399067057, + 0, + 1389.0914068829911, + 1494.9010265619356, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1373.346482535572, + 243.35844277436388, + 0, + 1616.7049253099335, + 0, + 0, + 292.1687449200269, + 1324.536180389908, + 0, + 449.32912283562945, + 2640.63399067057, + 0, + 0, + 3089.963113506192, + 0, + 1443.4291890275717, + 1646.5339244786217, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 346.506527064608, + 1389.0914068829911, + 0, + 292.1687449200269, + 1443.4291890275717, + 0, + 1735.5979339476005, + 0, + 0, + 1476.1690783065937, + 1494.9010265619356, + 0, + 1324.536180389908, + 1646.5339244786217, + 0, + 0, + 2971.070104868538, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2365.4610688919265, + 0, + 0, + 1673.0408662044476, + 692.4202026874725, + 0, + 701.2537525173432, + 1664.207316374577, + 0, + 0, + 4970.871376541409, + 0, + 338.6758609778965, + 4632.195515563498, + 0, + 2696.913125143314, + 2273.9582513981036, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1673.0408662044476, + 338.6758609778965, + 0, + 2011.7167271823464, + 0, + 0, + 567.5410838088235, + 1444.1756433735225, + 0, + 692.4202026874725, + 4632.195515563498, + 0, + 0, + 5324.615718250977, + 0, + 2830.6257938518384, + 2493.9899243991617, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 701.2537525173432, + 2696.913125143314, + 0, + 567.5410838088235, + 2830.6257938518384, + 0, + 3398.166877660661, + 0, + 0, + 1664.207316374577, + 2273.9582513981036, + 0, + 1444.1756433735225, + 2493.9899243991617, + 0, + 0, + 3938.165567772682, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "n_missing": 0, + "metadata": { + "references": {}, + "derived": true, + "type": { + "integer": false, + "missing_rules": {}, + "missing_reasons": { + "No Data": -1 + }, + "class": "numeric" + } + } + } + }, + "n": 12043, + "filter_stats": { + "filtered_complete": { + "unweighted": { + "selected": 12043, + "other": 0, + "missing": 0 + }, + "weighted": { + "selected": 12043.000484249482, + "other": 0, + "missing": 0 + } + }, + "filtered": { + "unweighted": { + "selected": 12043, + "other": 0, + "missing": 0 + }, + "weighted": { + "selected": 12043.000484249482, + "other": 0, + "missing": 0 + } + } + }, + "unfiltered": { + "unweighted_n": 12043, + "weighted_n": 12043.000484249482 + }, + "filtered": { + "unweighted_n": 12043, + "weighted_n": 12043.000484249482 + }, + "counts": [ + 4046, + 0, + 0, + 3232, + 814, + 0, + 470, + 3576, + 0, + 0, + 4573, + 0, + 462, + 4111, + 0, + 2465, + 2108, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3232, + 462, + 0, + 3694, + 0, + 0, + 434, + 3260, + 0, + 814, + 4111, + 0, + 0, + 4925, + 0, + 2501, + 2424, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 470, + 2465, + 0, + 434, + 2501, + 0, + 2935, + 0, + 0, + 3576, + 2108, + 0, + 3260, + 2424, + 0, + 0, + 5684, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1028, + 0, + 0, + 659, + 369, + 0, + 419, + 609, + 0, + 0, + 2396, + 0, + 148, + 2248, + 0, + 1111, + 1285, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 659, + 148, + 0, + 807, + 0, + 0, + 327, + 480, + 0, + 369, + 2248, + 0, + 0, + 2617, + 0, + 1203, + 1414, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 419, + 1111, + 0, + 327, + 1203, + 0, + 1530, + 0, + 0, + 609, + 1285, + 0, + 480, + 1414, + 0, + 0, + 1894, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3936, + 0, + 0, + 3169, + 767, + 0, + 418, + 3518, + 0, + 0, + 3910, + 0, + 435, + 3475, + 0, + 1943, + 1967, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3169, + 435, + 0, + 3604, + 0, + 0, + 382, + 3222, + 0, + 767, + 3475, + 0, + 0, + 4242, + 0, + 1979, + 2263, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 418, + 1943, + 0, + 382, + 1979, + 0, + 2361, + 0, + 0, + 3518, + 1967, + 0, + 3222, + 2263, + 0, + 0, + 5485, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1138, + 0, + 0, + 722, + 416, + 0, + 471, + 667, + 0, + 0, + 3059, + 0, + 175, + 2884, + 0, + 1633, + 1426, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 722, + 175, + 0, + 897, + 0, + 0, + 379, + 518, + 0, + 416, + 2884, + 0, + 0, + 3300, + 0, + 1725, + 1575, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 471, + 1633, + 0, + 379, + 1725, + 0, + 2104, + 0, + 0, + 667, + 1426, + 0, + 518, + 1575, + 0, + 0, + 2093, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3476, + 0, + 0, + 2750, + 726, + 0, + 553, + 2923, + 0, + 0, + 5058, + 0, + 415, + 4643, + 0, + 2865, + 2193, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2750, + 415, + 0, + 3165, + 0, + 0, + 498, + 2667, + 0, + 726, + 4643, + 0, + 0, + 5369, + 0, + 2920, + 2449, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 553, + 2865, + 0, + 498, + 2920, + 0, + 3418, + 0, + 0, + 2923, + 2193, + 0, + 2667, + 2449, + 0, + 0, + 5116, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1598, + 0, + 0, + 1141, + 457, + 0, + 336, + 1262, + 0, + 0, + 1911, + 0, + 195, + 1716, + 0, + 711, + 1200, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1141, + 195, + 0, + 1336, + 0, + 0, + 263, + 1073, + 0, + 457, + 1716, + 0, + 0, + 2173, + 0, + 784, + 1389, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 336, + 711, + 0, + 263, + 784, + 0, + 1047, + 0, + 0, + 1262, + 1200, + 0, + 1073, + 1389, + 0, + 0, + 2462, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 4393, + 0, + 0, + 3475, + 918, + 0, + 575, + 3818, + 0, + 0, + 5156, + 0, + 519, + 4637, + 0, + 2638, + 2518, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 3475, + 519, + 0, + 3994, + 0, + 0, + 531, + 3463, + 0, + 918, + 4637, + 0, + 0, + 5555, + 0, + 2682, + 2873, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 575, + 2638, + 0, + 531, + 2682, + 0, + 3213, + 0, + 0, + 3818, + 2518, + 0, + 3463, + 2873, + 0, + 0, + 6336, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 681, + 0, + 0, + 416, + 265, + 0, + 314, + 367, + 0, + 0, + 1813, + 0, + 91, + 1722, + 0, + 938, + 875, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 416, + 91, + 0, + 507, + 0, + 0, + 230, + 277, + 0, + 265, + 1722, + 0, + 0, + 1987, + 0, + 1022, + 965, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 314, + 938, + 0, + 230, + 1022, + 0, + 1252, + 0, + 0, + 367, + 875, + 0, + 277, + 965, + 0, + 0, + 1242, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2457, + 0, + 0, + 1951, + 506, + 0, + 340, + 2117, + 0, + 0, + 2996, + 0, + 297, + 2699, + 0, + 1537, + 1459, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1951, + 297, + 0, + 2248, + 0, + 0, + 315, + 1933, + 0, + 506, + 2699, + 0, + 0, + 3205, + 0, + 1562, + 1643, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 340, + 1537, + 0, + 315, + 1562, + 0, + 1877, + 0, + 0, + 2117, + 1459, + 0, + 1933, + 1643, + 0, + 0, + 3576, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 2617, + 0, + 0, + 1940, + 677, + 0, + 549, + 2068, + 0, + 0, + 3973, + 0, + 313, + 3660, + 0, + 2039, + 1934, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1940, + 313, + 0, + 2253, + 0, + 0, + 446, + 1807, + 0, + 677, + 3660, + 0, + 0, + 4337, + 0, + 2142, + 2195, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 549, + 2039, + 0, + 446, + 2142, + 0, + 2588, + 0, + 0, + 2068, + 1934, + 0, + 1807, + 2195, + 0, + 0, + 4002, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "element": "crunch:cube" + } + } +} \ No newline at end of file diff --git a/tests/integration/test_cubepart.py b/tests/integration/test_cubepart.py index f804f64de..2f2f40c3a 100644 --- a/tests/integration/test_cubepart.py +++ b/tests/integration/test_cubepart.py @@ -614,12 +614,12 @@ def it_respect_proportions_with_ordering_transform_ca_x_mr(self): "fixture, table_name, expected", [ (CR.EDU_FAV5_FAV5, "Education", True), - (CR.CAT_HS_X_MR_ITSELF, "Age (4 category)", True), - (CR.MR_X_MR_ITSELF, "Military Status", True), + (CR.CAT_HS_X_MR_AUGMENTED, "Age (4 category)", True), + (CR.MR_X_MR_AUGMENTED, "Military Status", True), (CR.AGE_FAVMR, None, False), ], ) - def it_knows_when_cube_is_mr_by_itself(self, fixture, table_name, expected): + def it_knows_when_cube_is_augmented(self, fixture, table_name, expected): cube = Cube(fixture) slice_ = cube.partitions[0] diff --git a/tests/integration/test_multiple_response.py b/tests/integration/test_multiple_response.py index 1463136ad..b42713213 100644 --- a/tests/integration/test_multiple_response.py +++ b/tests/integration/test_multiple_response.py @@ -456,7 +456,7 @@ def test_simple_mr_margin_by_col(): np.testing.assert_array_equal(slice_.rows_margin, [3, 4, 0]) -def test_cat_x_mr_x_itself_zscores(): +def test_cat_x_mr_x_augmented_zscores(): slice_ = Cube(CR.EDU_FAV5_FAV5).partitions[0] assert slice_.cube_is_mr_by_itself is True @@ -507,7 +507,7 @@ def test_cat_x_mr_x_itself_zscores(): ) -def test_cat_x_mr_and_cat_x_mr_x_itself_various_measures(): +def test_cat_x_mr_and_cat_x_mr_augmented_various_measures(): slice_ = Cube(CR.EDU_FAV5).partitions[0] slice2_ = Cube(CR.EDU_FAV5_FAV5).partitions[0] @@ -893,8 +893,8 @@ def test_mr_x_num_with_means_pruned(): np.testing.assert_almost_equal(slice_.counts, expected) -def test_mr_x_mr_itself_zscore(): - slice_ = Cube(CR.MR_X_MR_ITSELF).partitions[0] +def test_mr_x_mr_augmented_zscore(): + slice_ = Cube(CR.MR_X_MR_AUGMENTED).partitions[0] expected = [ [2.02358771, 4.40571894, -4.73781476], [1.6374635, 2.98524415, -2.88925509], diff --git a/tests/integration/test_pairwise_significance.py b/tests/integration/test_pairwise_significance.py index 7c5fd6901..09a28b4f0 100644 --- a/tests/integration/test_pairwise_significance.py +++ b/tests/integration/test_pairwise_significance.py @@ -399,51 +399,6 @@ def test_compare_to_column(self): np.testing.assert_almost_equal(actual.t_stats, expected_tstats) np.testing.assert_almost_equal(actual.p_vals, expected_pvals) - def test_cat_x_mr_itself_pairwise_compare_columns(self): - slice_ = Cube(CR.EDU_FAV5_FAV5).partitions[0] - - actual = slice_.pairwise_significance_tests[2] - expected_tstats = [ - [3.2386393, 2.09194923, 0.0, 2.8693425, -4.15518752], - [6.88147131, 5.97625571, 0.0, 6.76454926, -0.48584994], - [7.83715229, 3.62375238, 0.0, 4.59038147, -1.05390881], - [6.47017555, 2.36733655, 0.0, 2.08742665, -0.35158859], - ] - expected_pvals = [ - [ - 1.25043153e-03, - 3.67114360e-02, - 1.00000000e00, - 4.20783661e-03, - 3.49648630e-05, - ], - [ - 1.19420029e-11, - 3.24026250e-09, - 1.00000000e00, - 2.38187248e-11, - 6.27168180e-01, - ], - [ - 1.46549439e-14, - 3.05956626e-04, - 1.00000000e00, - 5.04126756e-06, - 2.92150962e-01, - ], - [ - 1.70207404e-10, - 1.81187549e-02, - 1.00000000e00, - 3.71254466e-02, - 7.25212661e-01, - ], - ] - - assert slice_.cube_is_mr_by_itself is True - np.testing.assert_array_almost_equal(actual.t_stats, expected_tstats) - np.testing.assert_array_almost_equal(actual.p_vals, expected_pvals) - def test_cat_x_cat_summary_pairwise_indices(self): # Only larger slice_ = Cube(CR.PAIRWISE_HIROTSU_OCCUPATION_X_ILLNESS).partitions[0] @@ -499,57 +454,291 @@ def test_ttests_use_unweighted_n_for_variance(self): ) np.testing.assert_array_equal(pairwise_indices, expected_indices) - def test_cat2_x_mr_itself_pairwise_compare_columns(self): - slice_ = Cube(CR.CAT2_X_MR_ITSELF).partitions[0] - actual = slice_.pairwise_significance_tests[1] + def test_cat_hs_x_mr_augmented_pairwise_t_test(self): + slice_ = Cube(CR.CAT_HS_X_MR_AUGMENTED).partitions[0] + actual = slice_.pairwise_significance_tests[0] assert slice_.cube_is_mr_by_itself is True np.testing.assert_array_almost_equal( actual.t_stats, - [[-1.11043969, 0.0, -38.08479951], [1.95585649, 0.0, -43.33389473]], + [ + [0.0, 6.22407684, np.nan], + [0.0, 0.21986422, np.nan], + [0.0, -2.39283195, np.nan], + [0.0, -3.83382639, np.nan], + ], ) np.testing.assert_array_almost_equal( - actual.p_vals, [[0.26797932, 1.0, 0.0], [0.05170342, 1.0, 0.0]] + actual.p_vals, + [ + [1.00000000e00, 2.28560104e-09, np.nan], + [1.00000000e00, 8.26172768e-01, np.nan], + [1.00000000e00, 1.75259091e-02, np.nan], + [1.00000000e00, 1.63076135e-04, np.nan], + ], ) - def test_cat_hs_x_mr_itself_pairwise_compare_columns(self): - slice_ = Cube(CR.CAT_HS_X_MR_ITSELF).partitions[0] - actual = slice_.pairwise_significance_tests[0] + def test_cat_x_mr_weighted_augmented(self): + """Same behaviour of test_mr_subvar_x_mr_augmented_pairwise_t_test""" + slice_ = Cube(CR.CAT_X_MR_WEIGHTED_AUGMENTED).partitions[0] + actual = slice_.pairwise_significance_tests[1] + overlap_margins = np.sum(slice_._cube.counts, axis=0)[:, 0, :, 0] + shadow_proportions_tab1 = slice_._cube.counts[0][:, 0, :, 0] / overlap_margins + shadow_proportions_tab2 = slice_._cube.counts[1][:, 0, :, 0] / overlap_margins + + assert slice_.cube_is_mr_by_itself is True + np.testing.assert_array_almost_equal( + overlap_margins, + [ + [4188.13667426, 3046.38734874, 1047.76027958], + [3046.38734874, 3628.42165249, 859.70982873], + [1047.76027958, 859.70982873, 5133.76481161], + ], + ) + np.testing.assert_array_almost_equal( + slice_.column_proportions, + [ + [0.71392963, 0.74796797, 0.55475245], + [0.28607037, 0.25203203, 0.44524755], + ], + ) + np.testing.assert_array_almost_equal( + shadow_proportions_tab1.diagonal(), slice_.column_proportions[0, :] + ) + np.testing.assert_array_almost_equal( + shadow_proportions_tab2.diagonal(), slice_.column_proportions[1, :] + ) + # each diagonal of the shadow proportions tab is equal to the correspondent row + # for the actual proportions + np.testing.assert_array_almost_equal( + actual.t_stats, + [[-10.2964264, 0.0, -20.09577285], [5.96350953, 0.0, 24.14335882]], + ) + np.testing.assert_array_almost_equal( + actual.p_vals, + [[0.0, 1.00000000e00, 0.0], [2.55612775e-09, 1.00000000e00, 0.0]], + ) + assert slice_._cube.counts.shape == (2, 3, 2, 3, 2) + assert actual.t_stats.shape == (2, 3) + + def test_mr_x_mr_weighted_augmented_pairwise_t_test(self): + """This test proofs the hypotesis testing for MR1_X_MR2 considering the + overlaps. To calculate the overlap of this kind of cube we need to calculate + the shadow proportion behind the MR1_X_MR2 table: + +-----------------------------------+ + | Trust | + +-------------------+-----------------------------------+ + | Pol.Know | | + +-------------------+----------- +---------+------------+ + | | NYTimes | WaPo | FoxNews | + +===================+============+=========+============+ + | Senate | 71.39 | 74.80 | 55.48 | + | Deficit | 67.75 | 72.58 | 44.91 | + | Unemp. | 62.70 | 66.04 | 68.24 | + | Tariffs | 80.47 | 83.61 | 64.52 | + | Elec.vot | 43.52 | 44.56 | 33.81 | + +-------------------+------------+---------+------------+ + + ==================SENATE - SELECTED (COUNTS)============== + +-----------------------------------+ + | Trust | + +-------------------+-----------------------------------+ + | Trust | | + +-------------------+----------- +---------+------------+ + | | NYTimes | WaPo | FoxNews | + +===================+============+=========+============+ + | NYTimes | 2990 | 2309 | 461 | + | WaPo | 2309 | 2714 | 428 | + | FoxNews | 461 | 428 | 2848 | + +-------------------+------------+---------+------------+ + + ==================SENATE - OTHER (COUNTS)================ + +-----------------------------------+ + | Trust | + +-------------------+-----------------------------------+ + | Trust | | + +-------------------+----------- +---------+------------+ + | | NYTimes | WaPo | FoxNews | + +===================+============+=========+============+ + | NYTimes | 1998 | 737 | 586 | + | WaPo | 737 | 914 | 431 | + | FoxNews | 586 | 431 | 2285 | + +-------------------+------------+---------+------------+ + + So to get the 71.39 we have to divide counts / margin. For example + the first shadow proportion will be 2990 / (2990+1198) where 2990 is the count + of the NYTimesXNYTimes in the Senate Selected tab and the denominator is the + sum of the counts of the Selected and Other Senate tab in the position (0,0). + + This procedure, is repeated for each couple of (selected and other) tabs for + each of the 5 Pol.Know variables. + + Given the shadow proportions and the overlap margins for all the tabs we use + these figures to calculate the t-statistic considering the overlaps. + + In this test we are comparing the first column `NYTimes` with the other 2 + using the correct t_stats arrays.""" + slice_ = Cube(CR.MR_X_MR_WEIGHTED_AUGMENTED).partitions[0] + actual = slice_.pairwise_significance_tests[1] + overlap_margins = np.sum(slice_._cube.counts[0], axis=0)[:, 0, :, 0] + # MRxMRxMR has (5, 2, 3, 2, 3, 2) shape, so 5 tabs of shadow proportions + shadow_proportions_tab = [ + (slice_._cube.counts[i][0][:, 0, :, 0] / overlap_margins) + for i in range(slice_._cube.counts.shape[0]) + ] assert slice_.cube_is_mr_by_itself is True np.testing.assert_array_almost_equal( actual.t_stats, [ - [0.0, -5.48459384, -26.49263374], - [0.0, -0.82075664, -31.36275346], - [0.0, 1.19221703, -33.43708574], - [0.0, 3.12076094, -27.21302499], + [-10.2964264, 0.0, -20.09577285], + [-16.38251357, 0.0, -28.57841019], + [-7.42875194, 0.0, 2.33766663], + [-10.88338158, 0.0, -22.45002834], + [-2.12632668, 0.0, -11.07466431], ], ) np.testing.assert_array_almost_equal( actual.p_vals, [ - [1.00000000e00, 1.09309460e-07, 0.00000000e00], - [1.00000000e00, 4.12638459e-01, 0.00000000e00], - [1.00000000e00, 2.34410124e-01, 0.00000000e00], - [1.00000000e00, 2.03575836e-03, 0.00000000e00], + [0.0, 1.00000000e00, 0.0], + [0.0, 1.00000000e00, 0.0], + [1.19015908e-13, 1.00000000e00, 1.94264286e-02], + [0.0, 1.00000000e00, 0.0], + [3.35015757e-02, 1.00000000e00, 0.0], ], ) - - def test_cat_subvar_x_mr_itself_pairwise_compare_columns(self): - slice_ = Cube(CR.CAT_SUBVAR_X_MR_ITSELF).partitions[0] + np.testing.assert_array_almost_equal( + slice_.column_proportions, + [ + [0.71392963, 0.74796797, 0.55475245], + [0.67749583, 0.72581913, 0.44912163], + [0.62702902, 0.6603541, 0.68236206], + [0.80466553, 0.8360987, 0.64524993], + [0.43519965, 0.44556699, 0.33807508], + ], + ) + # each diagonal of the shadow proportions tab is equal to the correspondent row + # for the actual proportions + np.testing.assert_array_almost_equal( + shadow_proportions_tab[0].diagonal(), slice_.column_proportions[0, :] + ) + np.testing.assert_array_almost_equal( + shadow_proportions_tab[1].diagonal(), slice_.column_proportions[1, :] + ) + np.testing.assert_array_almost_equal( + shadow_proportions_tab[2].diagonal(), slice_.column_proportions[2, :] + ) + np.testing.assert_array_almost_equal( + shadow_proportions_tab[3].diagonal(), slice_.column_proportions[3, :] + ) + np.testing.assert_array_almost_equal( + shadow_proportions_tab[4].diagonal(), slice_.column_proportions[4, :] + ) + assert slice_._cube.counts.shape == (5, 2, 3, 2, 3, 2) + assert actual.t_stats.shape == (5, 3) + + def test_mr_subvar_x_mr_augmented_pairwise_t_test(self): + """This test proofs the hypotesis testing for MR_SUBVAR_X_MR considering the + overlaps. To calculate the overlap of this kind of cube we need to calculate + the shadow proportion behind the SUBVAR_X_MR table: + +-----------------------------------+ + | Trust | + +-------------------+-----------------------------------+ + | Increasing Taxes | | + +-------------------+----------- +---------+------------+ + | | NYTimes | WaPo | FoxNews | + +===================+============+=========+============+ + | Selected | 82.71 | 85.96 | 63.21 | + | Other | 17.29 | 14.4 | 36.79 | + +-------------------+------------+---------+------------+ + + ==================TAB 1 - SELECTED (COUNTS)============= + +-----------------------------------+ + | Trust | + +-------------------+-----------------------------------+ + | Trust | | + +-------------------+----------- +---------+------------+ + | | NYTimes | WaPo | FoxNews | + +===================+============+=========+============+ + | NYTimes | 3464 | 2647 | 590 | + | WaPo | 2647 | 3119 | 529 | + | FoxNews | 590 | 529 | 3245 | + +-------------------+------------+---------+------------+ + + ==================TAB 2 - OTHER (COUNTS)================= + +-----------------------------------+ + | Trust | + +-------------------+-----------------------------------+ + | Trust | | + +-------------------+----------- +---------+------------+ + | | NYTimes | WaPo | FoxNews | + +===================+============+=========+============+ + | NYTimes | 724 | 400 | 458 | + | WaPo | 400 | 509 | 331 | + | FoxNews | 458 | 331 | 1889 | + +-------------------+------------+---------+------------+ + + So to get the 82.71 we have to divide counts / margin. For example + the first shadow proportion will be 3464 / (3464+724) where 3464 is the count + of the NYTimesXNYTimes in the first tab and the denominator is the sum of the + counts of the first tab and second tab in the position (0,0). + + Given the shadow proportions and the overlap margins for all the tabs we use + these figures to calculate the t-statistic considering the overlaps. + + In this test we are comparing the first column `NYTimes` with the other 2 + using the correct t_stats arrays. + """ + slice_ = Cube(CR.CAT_SUBVAR_X_MR_AUGMENTED).partitions[0] actual = slice_.pairwise_significance_tests[0] + overlap_margins = np.sum(slice_._cube.counts, axis=0)[:, 0, :, 0] + shadow_proportions_tab1 = slice_._cube.counts[0][:, 0, :, 0] / overlap_margins + shadow_proportions_tab2 = slice_._cube.counts[1][:, 0, :, 0] / overlap_margins assert slice_.cube_is_mr_by_itself is True np.testing.assert_array_almost_equal( actual.t_stats, - [[0.0, -1.0379925, -2.04481142], [0.0, -1.14023824, -60.07645576]], + [[0.0, 16.02651373, -22.43766743], [0.0, -6.56624439, 29.71952066]], + ) + np.testing.assert_array_almost_equal( + actual.p_vals, + [ + [1.00000000e00, 0.00000000e00, 0.00000000e00], + [1.00000000e00, 5.42792478e-11, 0.00000000e00], + ], + ) + np.testing.assert_array_almost_equal( + slice_.column_proportions, + [ + [0.82707248, 0.85960427, 0.63206628], + [0.17292752, 0.14039573, 0.36793372], + ], ) np.testing.assert_array_almost_equal( - actual.p_vals, [[1.0, 0.30036831, 0.04105959], [1.0, 0.25537821, 0.0]] + shadow_proportions_tab1, + [ + [0.82707248, 0.86881078, 0.56294105], + [0.86881078, 0.85960427, 0.61504991], + [0.56294105, 0.61504991, 0.63206628], + ], + ) + np.testing.assert_array_almost_equal( + shadow_proportions_tab2, + [ + [0.17292752, 0.13118922, 0.43705895], + [0.13118922, 0.14039573, 0.38495009], + [0.43705895, 0.38495009, 0.36793372], + ], + ) + np.testing.assert_array_almost_equal( + shadow_proportions_tab1.diagonal(), slice_.column_proportions[0, :] + ) + np.testing.assert_array_almost_equal( + shadow_proportions_tab2.diagonal(), slice_.column_proportions[1, :] ) - def test_mr_x_mr_pairwise_compare_columns(self): + def test_mr_x_mr_pairwise_t_test(self): slice_ = Cube(CR.MR_X_MR_2).partitions[0] actual = slice_.pairwise_significance_tests[1] @@ -574,29 +763,3 @@ def test_mr_x_mr_pairwise_compare_columns(self): [0.08853052, 1.0, 0.12423633], ], ) - - def test_mr_x_mr_itself_pairwise_compare_columns(self): - slice_ = Cube(CR.MR_X_MR_ITSELF).partitions[0] - actual = slice_.pairwise_significance_tests[1] - - assert slice_.cube_is_mr_by_itself is True - np.testing.assert_array_almost_equal( - actual.t_stats, - [ - [1.0379925, 0.0, -0.9156408], - [1.03178074, 0.0, -7.45906932], - [-0.57777416, 0.0, -18.5810699], - [-0.34165816, 0.0, -34.91068779], - [2.09893803, 0.0, -43.76650632], - ], - ) - np.testing.assert_array_almost_equal( - actual.p_vals, - [ - [3.00368306e-01, 1.00000000e00, 3.60015180e-01], - [3.03263297e-01, 1.00000000e00, 1.53432822e-13], - [5.63984270e-01, 1.00000000e00, 0.00000000e00], - [7.32921470e-01, 1.00000000e00, 0.00000000e00], - [3.69178553e-02, 1.00000000e00, 0.00000000e00], - ], - ) diff --git a/tests/unit/test_cubepart.py b/tests/unit/test_cubepart.py index ab84479c4..8bcd4a035 100644 --- a/tests/unit/test_cubepart.py +++ b/tests/unit/test_cubepart.py @@ -10,6 +10,7 @@ from cr.cube.cube import Cube from cr.cube.cubepart import CubePartition, _Slice, _Strand, _Nub from cr.cube.dimension import Dimension +from cr.cube.enum import DIMENSION_TYPE as DT from cr.cube.matrix import TransformedMatrix, _VectorAfterHiding from cr.cube.stripe import _BaseStripeRow, TransformedStripe @@ -67,6 +68,26 @@ def it_knows_if_cube_is_mr_by_itself(self): # --- default of False is overridden by subclasses when appropriate --- assert CubePartition(None).cube_is_mr_by_itself is False + @pytest.mark.parametrize( + "dims, expected_value", + ( + ((DT.CAT, DT.MR, DT.MR_CAT), DT.CAT), + ((DT.MR, DT.MR_CAT), DT.MR), + ((DT.MR_CAT,), DT.MR_CAT), + ), + ) + def it_knows_cube_row_dimension_type(self, request, cube_, dims, expected_value): + all_dimensions_ = tuple( + instance_mock(request, Dimension, name="dim-%d" % idx, dimension_type=dt) + for idx, dt in enumerate(dims) + ) + cube_.dimensions = all_dimensions_ + cube_partition = CubePartition(cube_) + + cube_row_dimension_type = cube_partition.cube_row_dimension_type + + assert cube_row_dimension_type == expected_value + def it_knows_the_primary_alpha_value_to_help(self, _alpha_values_prop_): """alpha is the primary confidence-interval threshold specified by the user.""" _alpha_values_prop_.return_value = (0.042, 0.084)