QScript StatisticalAssumptions
Jump to navigation
Jump to search
StatisticalAssumptions
Calculates cell significance, arrow sizes, and font colours from p-values, and exposes resolved statistical assumptions for reading or changing.
addSignificanceLevel(cutoff_p_value, size, font_size_multiplier, color_pos, color_neg, column_letters)
Adds a significance level.
| cutoff_p_value | The p-value cutoff for the new level; Range: 0 to 1. |
| size | The relative size of the significance symbol for the new level; Range: 1 to 100. |
| font_size_multiplier | The font size multiplier for the new level; Range: greater than 0, up to 100. |
| color_pos | The positive-result color, as "rgb(R, G, B)". |
| color_neg | The negative-result color, as "rgb(R, G, B)". |
| column_letters | The comma-separated column comparison letters, eg. 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z'. |
arrows(p_values, signs)
Given a 2D array of p-values, returns a corresponding array with arrow sizes. The signed values determine whether to use up or down arrows.
| p_values | A matrix of p-values. |
| signs | A matrix of signed values. |
| Example: | var arrows = table.cellArrows;
arrows[0][0] = table.statisticalAssumptions.arrows([[0.00001]], [[1]]);
table.cellArrows = arrows;
|
cellComparison
The multiple comparison correction applied to cell (row) comparisons, e.g. 'FDR'. See also cellMultipleComparisonCorrection, which reports only whether this is 'None'.
cellComparisonWithinRowAndSpan
Whether cell comparison correction is applied within each row and span, rather than across the whole table.
cellMultipleComparisonCorrection
Whether multiple comparison correction is enabled.
| Example: | alert("Multiple comparison correction is " + (table.statisticalAssumptions.cellMultipleComparisonCorrection ? "enabled" : "disabled"))
|
columnAnova
Whether cells are tested with an ANOVA-type test.
columnComparison
The multiple comparison correction applied to column comparisons, e.g. 'FDR'.
columnComparisonWithinRowAndSpan
Whether column comparison correction is applied within each row and span, rather than across the whole table.
correlationsTest
The way correlations are computed (numeric by numeric), e.g. 'Pearson'.
dateComparison
The way dates are compared in significance tests, e.g. 'ToRestOfData'.
equals(obj)
Whether two objects are the same.
| obj | The object to compare against. |
| Returns: | true or false |
| Example: | data_file.getQuestionByName('Q2').equals(data_file.questions()[0])
|
extraDeff
Additional design effect taken into account in significance testing, to reflect aspects of the sample design not taken into account by the weight.
fontColors(p_values, signs)
Given 2D arrays of p-values and signed values, returns a corresponding array with font colors. The signed values determine whether to use positive or negative colors.
| p_values | A matrix of p-values. |
| signs | A matrix of signed values. |
| Example: | var colors = table.cellColors;
colors[0][0] = table.statisticalAssumptions.fontColors([[0.00001]], [[-0.01]]);
table.cellColors = colors;
|
maxColumnsToCompare
The maximum number of columns to compare in column comparison tests.
meansBessel
Whether Bessel's correction is applied for the means test.
meansTest
The test used for tables involving means (categorical by numeric), e.g. 'tTest'.
minimalSampleSize
The threshold sample size below which significance is not tested.
nonSignificantTestSymbol
The symbol shown when a test could not be performed.
noTestSymbol
The symbol shown when a test was not performed.
overallSignificanceLevel
The overall significance level. Set null to reset this item's override or this project's default; non-null values must match a cutoff p-value in sigLevels.
| Example: | alert('The overall significance level is: ' + table.statisticalAssumptions.overallSignificanceLevel);
|
overlaps
How overlapping columns/rows are treated in significance tests, e.g. 'Default'.
poolVarianceSize
The sample size threshold for assuming variances are equal or unequal in t-tests/z-tests of means.
proportionBessel
Whether Bessel's correction is applied for the proportions test.
proportionTest
The test used for tables of proportions (categorical by categorical), e.g. 'ChiSquare'.
recycleSymbols
Whether the same column comparison letters are re-used within each span.
showAsGroups
Whether to indicate groups of columns that are not statistically different, rather than pairwise comparisons.
showRedundantTests
Whether significance is shown for both columns being compared, rather than just one.
showSignificance
The way significance is indicated on tables and plots, e.g. 'Arrows'. Getter returns null where multiple values are combined bitwise which is no longer supported by the UI.
sigLevels
Resolved significance levels. Incomplete rows may contain null appearance fields; writes require complete rows.
significance(p_values)
Given a 2D array of p-values, returns an array where each element is true if the corresponding p-value is less than or equal to the overallSignificanceLevel and false otherwise. Note that Q uses corrected p-values when determining cell significance, and this function assumes that the input p-values are already corrected.
| p_values | A matrix of p-values. |
| Example: | var significance = table.cellSignificance;
significance[0][0] = table.statisticalAssumptions.significance([[0.00001]]);
table.cellSignificance = significance;
|
significanceSymbol
The symbol used to show significance, e.g. 'Arrow'.
type
Returns 'StatisticalAssumptions'.
weightsAndSignificance
The way weights are taken into account when computing significance, e.g. 'Auto'.