For observations, let and count missing values of two variables, and let count observations on which both are available. The number missing at least one variable is . Applying the inclusion-exclusion principle to the two missing-value sets gives the displayed number missing both. The disjoint counts are consequently missing only , missing only , missing both, and complete cases. Their nonnegativity is a necessary consistency check on the supplied totals.
This identifies an aggregate missingness pattern without reconstructing individual records. It does not identify a missing-data mechanism, establish missing completely at random, or justify treating a substantive response such as an explicit unknown category as a missing observation. Counts from different cohorts cannot be inserted into the identity without first establishing a common denominator.
Age is available for all 1784 respondents. Blocking responses are available for 1700, and populism classification for 1692. Among valid responses, 15.76% report blocking someone and 71.75% are classified as populist. “Not know” is a recorded substantive response, distinct from the missing observations.
A frequency table gives category counts and percentages. A full-sample percentage divides by 1784, whereas a valid percentage divides by the number observed for that variable. A cumulative percentage adds categories in the displayed order. Differences between the two percentage columns therefore reflect missing values, while small discrepancies from 100% can arise from rounding error.
The age groups contain 329 respondents aged 18–24, 320 aged 25–34, 371 aged 35–44, 323 aged 45–54 and 441 aged 55+, approximately 18.44%, 17.94%, 20.80%, 18.11% and 24.72%. The oldest category is the largest, but it is open-ended and spans a different width from the younger categories, so its larger count does not establish a higher frequency per single year of age. The ordered cumulative 57.18% means that about that proportion is younger than 45. The displayed final 100.01% is compatible with rounding, not an extra respondent. There are no reported missing ages.
Blocking has valid counts 133 Not know, 1299 No and 268 Yes. Dividing by all respondents gives approximately 7.46%, 72.81% and 15.02%; dividing by the 1700 valid responses gives about 7.82%, 76.41% and 15.76%. The remaining 84 observations, 4.71% of the full sample, are missing. The distinction matters: 15.02% is not the same denominator-based statement as 15.76%. Not knowing that blocking was possible is a supplied answer category, not one of those 84 missing values. It should not be deleted or merged merely because its label contains “know”.
Blocking is a nominal categorical variable in this form. Yes and No identify a binary behaviour, while Not know additionally records awareness. There is no automatic substantive ordinal scale Not know No Yes. Consequently its cumulative percentage is tied to the printing order and should not be read as a universal low-to-high blocking scale. This point will limit interpretation of the later ordinal coefficients.
There are 478 observed Not-populist classifications and 1214 Populist classifications. These represent 26.79% and 68.05% of the full sample, or 28.25% and 71.75% of the 1692 classified respondents. The 92 missing classifications account for 5.16%. These percentages describe the particular classification and sample; the output does not supply the instrument used to define populism or establish prevalence in a wider population. Adding missing cases to either substantive group would invent their classifications.
The later table uses only 1629 observations with both blocking and populism observed. It is smaller than either marginal valid total, as expected under complete-case analysis. The missingness overlap from marginal and complete-case counts gives
Thus 63 have blocking missing but populism observed, 71 have populism missing but blocking observed, and 21 have both missing. These totals reconcile the denominators without reconstructing individual records. They do not establish a missing-data mechanism such as missing completely at random; selection into complete cases could affect later associations.
Employment is observed for all 2053 listed cases. Social media use is observed for 1424 cases, with 629 missing. The age percentages describe the five visible rows, whose counts total 1730; they cannot be treated as a complete age distribution for the stated 2053 cases.
A frequency table describes category counts and their relative frequencies. The full-sample percentage uses every listed case as denominator; a valid percentage excludes missing data for that variable. A cumulative percentage adds the valid percentages up to an ordered category. The denominator matters as much as the number: a statement about respondents with recorded use need not describe every respondent.
Employment is a binary categorical variable: 1216 cases are employed and 837 are not, or about and . Neither employment category is missing in this output. Employment labels have no intrinsic numerical spacing; codes zero and one identify the two categories under a chosen ordering convention. Cumulative percentages for a nominal categorical variable depend on the arbitrary display order and add little to this two-category description.
Age groups are an ordinal categorical variable because their intervals have a natural ordering, although the grouped representation loses exact ages. Among the five visible age rows, ages 25–44 form the largest group, with , and ages 14–24 the smallest, with . The other visible groups account for , and on that denominator. About of the visible five-row count is below 45. These percentages should not be silently applied to the stated total : for example, the same cases are only of .
The age variable key advertises six categories, whereas only five appear. Their counts sum to , leaving a difference of against the printed total; the table nevertheless prints zero missing values. This is an internal source discrepancy, not permission to label those cases as a particular unseen age group or as recorded missing data. The oldest row is labelled 65+ here but 65–74 in Figure 2. Even the age percentage total has a small display discrepancy: the five rounded percentages sum to , while the printed valid total and last cumulative percentage say . The much larger count inconsistency remains after allowing ordinary rounding.
Social media use is also an ordinal categorical variable. Its six ordered categories express increasing frequency, not equally spaced measurements: averaging category labels or claiming a one-unit change has a constant time meaning would require an additional scoring convention. Among the observed responses, the mode is never, at , followed by daily, at . Weekly use accounts for , use more than once a day for , less-than-monthly use for , and monthly use for . The first three categories together comprise about of valid responses. Consequently the middle ordered response lies in the weekly category: cumulative frequency first passes one half there.
Combining the two daily categories gives of valid responses using social media at least daily. The same recorded responses are of all listed cases. The second percentage is the fraction recorded as daily users, not an estimate that classifies all missing responses as nonusers. Missing social media responses make up . The directly calculated valid fraction is ; summing the individually rounded full-sample percentages produces the printed , a minor rounding difference. With no account of the missing-data mechanism, the observed valid distribution should not automatically be generalized to those with missing use. Employment being fully observed does not make social media missingness ignorable. The substantive distributional summary must retain both the valid-response denominator and the missing-data qualification.
Within the 1424 complete records displayed here, employed respondents report more frequent use on average in the ordinal sense of positive pairwise association. The overall independence test is significant, but its sample association magnitude is modest and the result is observational. Some printed ordinal summaries are internally inconsistent.
Compare row percentages because employment groups have different sizes. Never-use is reported by of the non-employed group and of the employed group. Daily use is versus ; more-than-daily use is versus . Combining the last two categories gives versus , an employed-minus-non-employed difference of about 11.26 percentage points. That threshold comparison is a descriptive summary of the six-category table, not a replacement for the original omnibus test or a newly declared prespecified endpoint. It does not assign equal spacing to the six frequency categories.
Here the row counts, column counts and grand total are additive. Under the null hypothesis of employment–use independence, a contingency table has statistical degrees of freedom. The Pearson chi-squared statistic recomputed from the cells is , agreeing with the printed value, and its p-value is about . The likelihood-ratio test statistic gives . Both reject independence at the conventional 5% and 1% significance levels under the sampling assumptions. The minimum expected frequency, about , gives no sparse-cell warning for this table. The tests compare whole category distributions; they do not by themselves identify one category as the source of the association or establish its causal direction.
Cramér's V is . The generalized phi coefficient coincides with it for this two-row table, while the contingency coefficient is about . These are modest magnitudes; a small p-value does not make the relationship large or useful for individual prediction. The employment–use association could change after conditioning on age or other covariates, and the sample excludes cases without recorded use. Relative to the employment margins in Figure 1, the omitted complete-case counts are non-employed and employed, or about and of those groups. Different missing fractions alone do not identify the missing-data mechanism, but they rule out treating complete records as automatically representative of everyone.
The count-based Goodman and Kruskal's gamma is
With the employment categories ordered non-employed then employed and use ordered from never to more than daily, this positive value means concordant pairs outnumber discordant pairs among pairs untied on both variables. It is not a 16.9% increase in a person's use and is not a causal effect. Reversing one ordering reverses its sign. Excluding ties can make gamma appreciably larger than tie-adjusted measures.
For use as response and employment as predictor, the cells give Somers' D about , Kendall's tau-b about and Stuart's tau-c about . The printed Somers value and tau-b should not be presented as verified calculations: the table prints second-variable-only ties, whereas its cells give . The other four pair classes agree with the cells; the printed five classes sum to , not . The source does not establish an alternative tie convention that repairs those ordinary identities. The direction remains a weak positive association under either description, but the exact measures require coherent pair counts.
Modal prediction provides another perspective. Without employment information, predicting the globally most frequent use category, never, makes errors. Predicting a separate modal use category in each employment group makes errors. Thus Goodman and Kruskal's lambda for use given employment is : about a 1.97% reduction in modal-classification errors. For employment given use the corresponding reduction is . These identify the targets explicitly; the source's row-dependent/column-dependent labels should not be used to reverse the target interpretation. The two small numbers show why an independence test can be significant while coarse modal prediction improves very little. The supported overall finding is a modest positive association among observed respondents, requiring conditional analysis and a missing-data qualification before broader claims.
The ordinary least squares fit estimates the conditional mean of the continuous safety response as a linear function of the income coding:
The regression coefficient for income is positive. Since larger response values mean greater safety, one additional coded income unit corresponds to an estimated increase of safety-scale units in the fitted mean. Following the question's stated units, a unit is a £10,000 income step. The observed coding also uses income bands with open end categories, so this is a linear trend per coded band step; it is not evidence of a known constant effect for every extra pound, especially within the open top band. The output's abbreviated variable label does not override the stated units.
The intercept is the fitted mean at income code zero. It is estimated as , but zero is outside the observed income codes, so that value is an extrapolated model baseline, not an observed estimate for a particular income category. Its small p-value tests a zero intercept; it is not the main test of the income association.
For the income coefficient, the standard error is . The reported test statistic and two-sided test give
providing strong evidence against the null hypothesis of zero linear slope under the stated model assumptions. A Student t confidence interval, using residual statistical degrees of freedom, is
This is an interval for the population linear coefficient under the model, not an interval containing of individual safety scores. The large-sample estimate is precise enough to detect a positive association, but that does not establish substantial individual predictive power.
The coefficient of determination is : the fitted line accounts for about of the in-sample variation about the response sample mean. The adjusted coefficient of determination is about . Thus income alone explains very little of the observed variation, despite the small slope p-value. The residual standard error of response units describes substantial scatter about the fitted line. This is an estimated residual standard deviation, rather than the standard error of the slope or a complete individual prediction interval.
The overall F-test has on statistical degrees of freedom and . With one predictor and an intercept, it tests the same zero-slope hypothesis as the coefficient Student's t-test; , up to rounding. It is not an additional independent confirmation. In this simple linear regression, the Pearson correlation coefficient has the slope's sign and magnitude , another description of the weak linear association.
The regression uses complete observations and estimates two coefficients, giving residual statistical degrees of freedom. The deletion of observations is complete-case analysis; extending its conclusions to the full target population requires suitable assumptions about the missing-data mechanism. Classical reported standard errors also rely on an adequate linear conditional mean, independent errors and homoscedasticity; a normal linear model gives the finite-sample Student t-distribution and F-test calibration, while large-sample approximations can justify similar tests under weaker distributional assumptions. The printed summary alone does not establish these assumptions. Regression diagnostics and, where appropriate, heteroskedasticity-consistent standard errors address different parts of that assessment.
Finally, this unadjusted observational study estimates an association. Other covariates, such as age or experience status, may be related to both income and reported safety. Without additional design or causal identification assumptions, the positive fitted slope does not establish that increasing income would cause an increase in safety.
scan reads the numerical prices, including the three missing-value markers, into a vector. The data must be read row by row for the subsequent factor construction to match them. The sample size available for analysis is therefore , rather than . The numerical summary describes the observed prices: the sample median is £43.54 and the sample mean is £46.94. The upper tail, particularly the boots, raises the sample mean above the sample median. These summaries mix very different products and are not adjusted country comparisons.
The two character scans create labels. gl(8,5,length=40,labels=item) makes a regression factor with each of eight item labels repeated five times. gl(5,1,length=40,labels=country) cycles through the five country labels once for each item. For a regression factor and numerical response, the two plot commands produce grouped box plots. The country box plots suggest lower US prices, while the item box plots show particularly expensive boots and inexpensive cardigans. They are descriptive displays of this small basket, with different item compositions where prices are missing; they cannot separate country effects from item effects.
The first lm fits an additive two-way analysis of variance:
The constraints are R's usual treatment coding. The normal linear model used for the printed tests assumes independent errors with common variance and approximately a normal distribution, and no item-by-country interaction in the mean. Missing prices are omitted, leaving responses and independent mean coefficients. Thus the residual degrees of freedom are . This deletion is defensible for the conditional price model when missingness does not depend on the unobserved error after conditioning on the two factors; the output itself does not establish such a missing-data mechanism.
The anova tables report sequential sums of squares, rather than order-independent adjusted effects. If are the residual sums of squares from the intercept-only, country-only, item-only and additive fits, the first order allocates to country and to item. The second order allocates to item and to country. Both allocations sum to the same total explained sum of squares, and both end with the same residual sum of squares . The three missing combinations destroy balanced factorial orthogonality, so the allocation changes with order. To test country after allowing for items, use the country row in the second table; to test item after allowing for countries, use the item row in the first table. The first-entered rows do not supply those adjusted tests.
Each mean square in ANOVA divides its sum of squares in ANOVA by its statistical degrees of freedom, and each printed F-statistic divides that mean square in ANOVA by . In particular, the adjusted country partial F-test has
with an reference F-distribution and p-value approximately . The adjusted item partial F-test gives on statistical degrees of freedom. Both factors contribute strongly under the additive normal linear model. The larger item sum of squares in ANOVA measures the much greater differences between these products, but is not evidence that every pair of items differs significantly.
The intercept is the fitted UK price for the reference jeans, not their observed price and not the overall sample mean. Each country regression coefficient is its adjusted price difference from the UK, assumed common across items: Sweden is £5.224 lower, France £10.708 lower, Germany £7.676 lower and the US £21.328 lower. Each item regression coefficient is its adjusted difference from the reference jeans, assumed common across countries. Thus the fitted UK boots price is , and the fitted US boots price is .
The coefficient standard errors come from , where and is the design matrix. Dividing each estimate by its standard error gives the displayed Student t-test statistic, with statistical degrees of freedom. The stars summarize the corresponding two-sided p-values. The individual tests compare each indicated country or item with its reference level, conditional on all other additive terms; they are neither tests of every pairwise comparison nor a simultaneous confidence interval procedure. In particular, Sweden's p-value provides weaker evidence than the other country contrasts, and does not establish equality with the UK. The intercept test has little substantive relevance, and interpreting many individual stars also raises multiple hypothesis testing issues.
The residual standard error measures unexplained prices in pounds. With total corrected sum of squares , the coefficient of determination and adjusted coefficient of determination are
Much of this impressive fit is due to the large differences between items. The overall F-test compares the additive fit with a constant mean: on statistical degrees of freedom. It tests that all eleven non-intercept coefficients vanish, not that the additive model is adequate. Regression diagnostics should examine regression residuals, changing price variability across items and possible interaction. Percentage differences may be more plausible than common pound differences, motivating a natural logarithm of price. No random sample of countries or products, and no independent replication of a price within a cell, is supplied; broad claims about all designer goods or the causes of country differences require more than these conditional tests.
Finally, Item*Country expands to both main effects and their full interaction. A cell-means parameterization has one separate fitted mean for every observed cell. With one response per cell its design matrix has row matrix rank , while the full layout nominally has coefficients. Three coefficient combinations are aliased because their cells are missing. This is saturation of an unreplicated two-factor regression: every observed price is fitted exactly and the residual degrees of freedom are zero. The final fit has zero residuals, and no residual-based estimate of the error variance or ordinary interaction significance test. The printed numerical summary will mark three coefficients unestimable; coefficient standard errors, tests and adjusted involve undefined division by zero, potentially appearing as NaN or Inf according to numerical roundoff. Perfect interpolation here is a consequence of a saturated statistical model, not evidence for a superior predictive model.
Write for the binary response, for the partner count, and for fully observed background variables. Let indicate which of are observed, with 1 meaning observed. For any realised pattern , partition the data into and .
Missing completely at random means that the missing-data mechanism does not depend on any of the measurements:
Missing at random allows dependence on the data observed under the particular pattern, but no further dependence on its unobserved values:
Thus a response probability depending on fully observed age or sex can satisfy missing at random. Dependence on an observed partner count can also be permissible for patterns in which that count is available. Missing not at random means that this equality fails: the probability of the pattern still depends on one of its missing measurements, after conditioning on the observed ones. The distinction concerns dependence on the unseen values, not whether missingness looks haphazard. These definitions can be applied within the target population ; unknown membership of that population must itself be handled when is missing.