Summarizes one continuous outcome across the levels of several
categorical variables, one block of rows per variable. It is the
inverse layout of table_continuous(), which puts several outcomes
in rows and one grouping in columns.
Each block reports the outcome's statistics level by level, plus its
own group comparison on the block's header row, and an Overall row
gives the marginal summary of the whole analytic sample.
Usage
table_outcome(
data,
outcome,
select,
labels = getOption("spicy.var_labels", FALSE),
note_labels = NULL,
overall = TRUE,
drop_na = FALSE,
weights = NULL,
rescale = getOption("spicy.rescale", FALSE),
test = c("welch", "student", "nonparametric"),
p_value = NULL,
p_adjust = "none",
statistic = FALSE,
show_n = TRUE,
show_columns = NULL,
effect_size = c("none", "auto", "hedges_g", "eta2", "r_rb", "epsilon2"),
effect_size_ci = FALSE,
ci = TRUE,
ci_level = 0.95,
digits = 2,
effect_size_digits = 2,
p_digits = 3,
decimal_mark = ".",
align = c("decimal", "center", "right"),
note = NULL,
note_add = NULL,
output = c("default", "data.frame", "long", "tinytable", "gt", "flextable", "excel",
"clipboard", "word"),
indent_text = " ",
indent_text_excel_clipboard = strrep(" ", 6),
excel_path = NULL,
excel_sheet = NULL,
clipboard_delim = "\t",
word_path = NULL,
word_template = NULL,
user_na = TRUE,
style = NULL,
by
)Arguments
- data
A data frame.
- outcome
The continuous outcome, unquoted or as a string. Exactly one column.
- select
The grouping characteristics to describe the outcome across, as a tidyselect expression or a character vector of column names. One block of rows per variable, in the order given, and in each block one row per level: the levels of a factor in their order, any other variable sorted, as the groups of
byare intable_continuous()(text in the C locale,FALSEbeforeTRUE, numbers ascending, a labelled column by its value labels), whatever the order of the rows. As everywhere in the family,selectis what structures the rows. The outcome and theweightscolumn are not part of the selection: a selection helper skips them, and naming one inselect, or giving its position, is an error. A name that is not a column ofdatais an error (classspicy_missing_column), and so is an empty selection.- labels
How each variable is named in the table: in the rows, in the title, and in the notes. The outcome follows the same rule as the
selectvariables. Four forms:labels = FALSEshows the column name.labels = TRUEshows the column'slabelattribute (as set byhaven,labelled, orlabel_from_names()) when it is present, notNA, and not empty, and the column name otherwise.labels = c(bmi = "Body mass index"), a named character vector, gives the columns it names these labels. Every other column followsoptions(spicy.var_labels): its name when the option is unset orFALSE, itslabelattribute when it isTRUE.labels = var_labels(bmi = "BMI (kg/m2)")gives the columns it names these labels, and every other column itslabelattribute, whatever the option says.var_labels()alone islabels = TRUE.
A name that matches no column of the table warns (class
spicy_unknown_name) and is left out, so one vector can still serve every table of a project. The default readsoptions(spicy.var_labels), and aTRUEorFALSEtyped in the call wins over it. Any other value,NULLincluded, is an error. A variable label documents the data file; a published table carries the wording you set here.note_labelsgives a variable a shorter label in the title and the notes.- note_labels
The label a variable takes where the table names it in a sentence, in the title and in the notes, in place of the one
labelsgives it: a named character vector,note_labels = c(sex = "sex at birth"), or avar_labels()object, which reads as one.labelscan then name a row with a whole question while the note says "Missing values removed: sex at birth (2).". The rows, the column headers and the spanners keep the labels oflabels, and so do the title and the notes for a variablenote_labelsdoes not name. A name that matches no column warns and is left out, as inlabels, andNULL(the default) renames nothing. A note label that another variable of the table shows is an error (classspicy_label_collision): choose another one, or relabel the other variable.- overall
Show the marginal
Overallrow (defaultTRUE).- drop_na
Drop rows with a missing
selectvalue from that block. The rule of the family: the categories a table counts keep their missing values as a row by default, as intable_categorical(); the values it computes on lose them, counted in the note, as intable_continuous(). The blocks of this table are categories, soFALSE(the default) shows the missing values of aselectvariable as a(Missing)level, excluded from the comparison, and a level displayed with that label is an error, as intable_categorical(); the missing values of the outcome are always removed and counted in the note.TRUEremoves those of aselectvariable from its block, and the note lists the variable after the outcome ("Missing values removed: age (3), sex (2)."): a missing outcome takes the row out of every block, a missingselectvalue only out of its own block. Underdrop_na = TRUE, a grouping that no observation holds is an error (classspicy_invalid_data).- weights
Optional case weights: an unquoted column name, a character column name, or a numeric vector of length
nrow(data). Weights must be non-negative and finite; rows withNAor zero weight leave every statistic (includingMin/Max) andNAweights are disclosed in the table note. The weighted formulas follow the frequency-expansion convention – see the Weights section. The weighted table names its weights in the note ("Statistics weighted by ..."). Group tests and effect sizes are not computed under weights: usetable_continuous_lm()for weighted comparisons.- rescale
Logical. If
TRUE, weights are first normalized so that they sum to the number of observations used for each variable – the samerescalegrammar astable_categorical(). This is the sampling-weights reading: results become invariant to the scale of the weights, and the weighted SD then equals Stata's[aweight]/survey::svyvar()value exactly.FALSEuses the weights as given (frequency reading). The default readsoptions(spicy.rescale),FALSEwhen it is unset.- test
Group comparison for every block:
"welch"(default),"student"or"nonparametric". An outcome with no variance in a block has no test there, whichever is chosen, with a warning (classspicy_undefined_stat); so has an outcome constant within each level of a block (a residual variance of zero) under"welch"and"student", while the rank tests, which read the order of the values, run. The block's test cells (test, p-value, effect size) show the undefined mark, as do those of any block whose comparison cannot run (too few observations in a level, a test that fails, a non-finite effect size).- p_value
Show the p-value column:
TRUE,FALSE, orNULL(the default), which shows it, every block being a comparison.- p_adjust
Multiple-comparison adjustment of the p-value column, applied to the family of every test in the table (one p-value per block). One of
"none"(default),"holm","hochberg","hommel","bonferroni","BH"/"fdr", or"BY", as intable_regression(); delegated tostats::p.adjust(). Needs the p-value column. See Multiple-comparison adjustment.- statistic
Logical. If
TRUE, the test statistic of each block is shown in an additional column, with or without the p-value:p_valueandstatisticare independent. Defaults toFALSE.- show_n
Logical. If
TRUE, includes an unweightedncolumn in the printed ASCII table and in every rendered output (tinytable,gt,flextable,word,excel,clipboard). Set toFALSEto drop thencolumn structurally from those outputs (no empty placeholder, no spanner). Thencolumn is always present inoutput = "long"for downstream programmatic access. Defaults toTRUE. Ignored (with a warning) whenshow_columnsis supplied.- show_columns
Statistics to display, as a character vector of the tokens of
table_continuous()(see Choosing the statistics).NULL(the default) shows the mean, SD, min, max, the mean CI (seeci) andn(seeshow_n).- effect_size, effect_size_ci
Effect size per block and its confidence interval, as in
table_continuous()(a logicaleffect_sizeis an error there and here).- ci
Logical. If
TRUE, includes the mean confidence interval columns (<level>% CI LL/<level>% CI UL) and their spanner in the printed ASCII table and in every rendered output (tinytable,gt,flextable,word,excel,clipboard). Set toFALSEto drop both columns and the CI spanner structurally from those outputs (no empty placeholders, no border lines under an empty header). The CI bounds are always present asci_lower/ci_upperinoutput = "long"for downstream programmatic access. Defaults toTRUE. The CI level is taken fromci_level. Ignored (with a warning) whenshow_columnsis supplied.- ci_level
Confidence level for the mean confidence interval (default:
0.95): a number strictly between 0 and 1.- digits
Number of decimal places of the descriptive statistics (default:
2). A whole number: a fraction is an error, as for every*_digitsargument. Test statistics keep two decimals.- effect_size_digits
Number of decimal places for effect-size values in formatted displays (default:
2).- p_digits
Integer >= 1. Number of decimal places used to render p-values in the
pcolumn (default:3, the APA Publication Manual standard). Both the displayed precision and the small-p threshold derive from this argument:p_digits = 3prints.045and<.001;p_digits = 4prints.0451and<.0001;p_digits = 2prints.05and<.01. Useful for genomics / GWAS contexts with very small p-values, or for journals using a coarser convention. Leading zeros are always stripped, following APA convention.- decimal_mark
The decimal mark, a single character:
"."(the default) or","in most styles; the Lancet style ofspicy_style()uses the middle dot. In the Excel sheet, a cell of one number shows the decimal separator of the reader's Excel (Excel output in spicy-package).- align
Horizontal alignment of numeric columns in the printed ASCII table and in the
tinytable,gt,flextable,word,excel, andclipboardoutputs. The first column (Variable) andGroup(when present) are always left-aligned. One of:"decimal"(default): align numeric columns on the decimal mark, the standard scientific-publication convention used by SPSS, SAS, and LaTeXsiunitx. Numeric cells are pre-padded with figure-spaces (U+2007, digit-width) so every string in a column has the same width with the decimal mark at the same internal position; centering those uniform-width strings then stacks the decimal points vertically. The same pad-then-center strategy is applied on every rendering engine (gt,tinytable,flextable,word, ASCII print) for a homogeneous rendering, matchingtable_regression()andtable_continuous_lm(). Theclipboardoutput is delimited text meant to be parsed rather than read at a fixed width, so its cells travel unpadded (a padded number pastes as text next to an unpadded number)."center": center-align all numeric columns."right": right-align all numeric columns.
"center"and"right"reach theexceloutput too."decimal"does not: Excel cells are written unpadded, because cell-string padding does not align decimals under a proportional font, so the workbook keeps the engine's own convention instead – counts and the p-value right-aligned, the other numeric columns centered. Same default and same three values astable_continuous_lm(), whoseexceloutput still uses that convention at everyalign.- note
The note under the table.
NULL(the default) builds it: the general note, one paragraph opened by the lead-in of the style ("Note." by default, none under thejamaandlancetthemes; seenote_labelinspicy_style()), then, in atable_regression()withstars, the legend of the stars on a line of its own. A single string replaces the general note, the sentences the table writes about its data included. It is printed as typed, line breaks ("\n") included, after the lead-in of the style, which a string opening with a lead-in of its own does not repeat (note = "Note. Data weighted."), and the legend of the stars stays below it.""keeps that legend alone, and no note at all without stars.FALSEremoves the note from every output, the legend included.- note_add
Sentences to add to the note: a character vector of one or more strings, each printed as typed (no period is added) and joined to the note by a space. They close its paragraph, after the definitions of the abbreviations and before the legend of the stars, in every output and in
attr(x, "note"), and the sentences the table writes stay. With a string innote, they follow it, so a wrapper can add a house sentence to every table while one table replaces its note. AnNAor an empty string is an error, and so isnote_addwithnote = FALSE, which leaves no note to add to.- output
One of
"default","data.frame","long", or a rendering engine:"tinytable","gt","flextable","excel","clipboard","word"."data.frame"is the displayed table with its numbers,"long"the compute frame with every statistic, as intable_continuous(); see Value.- indent_text
Prefix used for modality labels in report table building. Defaults to
" "(two spaces).- indent_text_excel_clipboard
Stronger indentation used in Excel and clipboard exports. Defaults to six non-breaking spaces.
- excel_path
File path for
output = "excel", ending in".xlsx", in a directory that exists. A file already at that path is replaced: each call writes a new workbook.- excel_sheet
Sheet name for
output = "excel".NULL(the default) uses"Outcome". The workbook holds this one sheet: a second call with the sameexcel_pathreplaces the file and does not add a sheet.- clipboard_delim
Delimiter for
output = "clipboard"(default:"\t"). A cell holding the delimiter itself, a double quote or a line break is quoted RFC 4180-style, so the grid survives whatever delimiter you choose.- word_path
File path for
output = "word", ending in".docx", in a directory that exists.- word_template
Optional path to a custom .docx file used as the template for
output = "word". The template's header, footer, page size, margins, and named styles ("Table Caption" in particular) are honored; the table is appended to the template body. Useful for institutional templates with pre-set headers ("APA Style", "Manuscript Submission Template", etc.). DefaultNULL(uses flextable's stock template).Customizing the caption appearance: the table caption is tagged with the Word named style
"Table Caption". The visual rendering (italic / bold / color / font) follows whatever that style is set to in the docx template. The stock Word template renders"Table Caption"in italic, the type of the APA table title (APA Manual 7 section 7.11, p. 201), where the APA puts the bold table number on its own line above it (section 7.10, p. 200). For a different appearance (Nature-style bold non-italic, APA-strict 2-line bold-number / italic-title, etc.), edit the"Table Caption"style in a docx template and pass it viaword_template = "your_template.docx". Style-based delegation keeps the rendered caption consistent with the surrounding document and lets editorial conventions (Nature, APA-strict, journal-specific) be applied without modifying the call site.- user_na
Logical. If
TRUE(the default), declared missing values are treated as missing: those of the outcome leave its statistics and are disclosed in the table note (Declared missing values removed: ...), those of aselectvariable join its(Missing)level underdrop_na = FALSE. IfFALSE, the declared codes are ordinary values. See the "Declared missing values" section offreq().- style
A journal style: a theme name (
"jama","nejm","lancet","annals","apa","aer"), aspicy_style()object, orNULL(the default). A style only changes DEFAULTS – any argument you pass explicitly wins over it. Setoptions(spicy.style = )for document-wide scope. A theme covers numeric formatting, the word that opens the note and the abbreviations the note defines, not full editorial conformity;?spicy_stylelists the exact rules each one encodes and the official document they come from. An unknown name is an error.- by
Defunct. The grouping characteristics are selected with
selectsince spicy 0.13.0; supplyingbyis an error.
Value
Depends on output:
"default": aspicy_outcome_table(adata.framesubclass, with the parent class"spicy_table"), printed when the call is bare; its columns are the table's compute frame, and the display frame and the typed view are attached."data.frame": the displayed table with its numbers, what as.data.frame() of the default object returns: one row per printed row, the key columnsvariable(the outcome on theOverallrow, the grouping variable elsewhere),label,leveland.row_role("summary"for theOverallrow,"factor_header","level", or"missing"), then one column per displayed column ("M","SD", ...,"n","p", named as intable_continuous()), a cell that prints several numbers keeping the others beside it as intable_continuous()."long": the compute frame, one row per printed row with every statistic the table computes, whatever it displays:variable,label,level,.row_role,mean,sd,min,max,ci_lower,ci_upper,median,q1,q3,iqr,med_ci_lower,med_ci_upper,n,weighted_n, the test of each block on its header row (test_type,statistic,df,df.residual,p.value, andp_unadjustedunderp_adjust) and its effect size (es_type,es_value,es_ci_lower,es_ci_upper,NAwhen none was requested)."tinytable","gt","flextable": the rendered table."excel"/"word": writes the file and returns its path invisibly."clipboard": copies the table and returns the displaydata.frameinvisibly.
The default object and the two data frames carry the whole note as
printed, its lead-in included, in attr(x, "note") (NULL when there
is nothing to say). The default object also keeps the title it prints in
attr(x, "title").
Which shape do I need?
Several continuous variables across one grouping is
table_continuous() (select = , by = ). One continuous variable
across one or several groupings is this function. A single select is
legitimate here – it is the natural way in when you know more
groupings are coming – but with several outcomes and one grouping,
the sibling is the table you want.
Choosing the statistics
show_columns takes the same tokens as table_continuous(), with
the same meanings, and shows them in the order they are written; see
the Choosing the statistics section of ?table_continuous for the
vocabulary and the place of an interval. Only the character-vector
form is accepted here: there is one outcome, so a per-variable list
would name nothing.
Weights
weights applies the frequency-expansion convention of the family:
all weights 1 reproduces the unweighted table, and integer weights
reproduce the STATISTICS of the data duplicated that many times –
n stays the raw count of rows that carried the weights. Rows
with a missing or zero weight leave the analytic sample; the note
counts the missing ones.
rescale is the switch between the two readings of a weight: the
frequency reading above, and the sampling-weight reading, where the
weights are normalized to sum to the sample size. See the Weights
section of table_continuous() for the choice in full.
rescale = TRUE normalizes the weights over the outcome's whole
surviving sample, once, never per level – a per-level rescale
would destroy the relative weights across levels, which is the
entire information a sampling weight carries into this table. The
means are unchanged by it; the standard deviations move, because
their denominator is sum(w) - 1.
A weighted table refuses the group comparison. The estimates and
their interval have no weighted version here, and a p-value or an
effect size silently computed unweighted beside weighted
descriptives is the one thing that must not happen: set p_value = FALSE (and statistic = FALSE, effect_size = "none"), or use
table_continuous_lm() for a weighted comparison. The
order-statistic median interval is refused for the same reason.
Blocks and the group comparison
Every block is a separate one-way comparison of the outcome across the levels of that variable. Nothing in this table adjusts one block for another, and the table note says so. Read the blocks as a set of bivariate descriptions, not as a model.
Each block chooses its test independently: with two observed levels
test = "welch" is the Welch t-test, with three or more it is the
Welch one-way ANOVA, and test = "nonparametric" is the
Wilcoxon rank-sum or the Kruskal-Wallis test on the same rule. A
block with fewer than two observed levels, or with a level holding a
single observation, is not tested; its statistics stay empty and the
other blocks are unaffected.
A level where the outcome has no observed value (typically a question
not asked there) has no data, which is not a missing answer: its cells
show an en dash, n included, the block compares the levels with
data, the rows of that level are not counted in the outcome's missing
values (whichever block they fall in), and the note says so ("No data
for X in G.", X the label of the outcome and G the level). The
Overall row stays the whole analytic sample.
The Overall row
overall = TRUE puts the marginal summary of the whole analytic
sample on the first row. Under the default drop_na = FALSE the
levels of every block partition that sample – the (Missing)
display level included – so each block's counts add up to the
Overall count exactly, which is what makes it a usable
denominator.
The row reads Overall, not Total, and the distinction is
deliberate. Total is the word of a COUNT margin: the column of
table_categorical() where frequencies add up. This row is the
whole analytic sample, where a mean is recomputed over every
observation and nothing is added. A mean is not a total.
A select variable displayed as "Overall" is an error (class
spicy_label_collision): choose another label in labels, or give the
row another label with
options(spicy.labels = list(row_overall = "Whole sample")).
Choosing the select columns
The canonical form is select = where(is.factor), or an explicit
enumeration. Negation (select = -c(x, y)) is not recommended: it
sweeps in every remaining column, and a numeric one becomes a block
with one LEVEL per distinct value, in ascending order. A
variable producing more than 20 levels raises a warning for that
reason – an arbitrary threshold, but a sixty-row block where a
reader expects a handful of categories is not a table.
A haven_labelled column used as select names its levels by their
value labels ("[1] Women"), in the order of its labels attribute
when every observed value carries a label and by ascending code
otherwise, as a labelled by names its groups in table_continuous()
and as the rows of a labelled variable of table_categorical() read.
The table note
One note sits under the table. It opens with the sample size, as in
table_categorical(), "N = 159.": the rows of the data, a row with a
missing or zero weight left out, rows rather than weights under
weights ("N = 60 (unweighted)."), the outcome's complete cases in the
n of the Overall row (spicy_style(sample_size = "none") leaves the
sentence out, see spicy_style()). It then states what left the analytic
sample, which group comparison ran in each block, what the displayed
columns mean, and how the blocks and the Overall row are to be
read. The rendering engines carry the same sentence as a table note.
On the "tinytable" route it is set one size down;
options(spicy.note_style) governs that (see table_regression()).
Multiple-comparison adjustment
The p-values of a descriptive table describe: they test no
prespecified hypothesis. STROBE (explanation of item 14) advises
against significance tests in descriptive tables, hence the default
p_adjust = "none".
When a journal or a protocol asks for adjusted p-values anyway,
p_adjust applies stats::p.adjust() to the family of every test in
the table: one p-value per variable (one per block in
table_outcome()), never the rows of one variable, which share one
test. "holm" suits a confirmatory set of comparisons, "BH" a
screening one; table_regression() lists the methods. A test that
returned no p-value stays out of the family.
The adjustment runs before any formatting, so the p column and its
<.001 threshold show the adjusted values, and the table note gives
the number of tests and the method. The raw p-values stay in the
object: a p_unadjusted column next to the p-value column of the
returned data frames, and col_meta$p$p_unadjusted (with the method
in p_adjust and the family size in p_adjust_m) in
as_structured(). Without by, or with p_value = FALSE, the table
shows no p-value to adjust, and a p_adjust other than "none" is an
error.
References
American Psychological Association. (2020). Publication manual of the American Psychological Association (7th ed.). doi:10.1037/0000165-000
Vandenbroucke, J. P., von Elm, E., Altman, D. G., Gøtzsche, P. C., Mulrow, C. D., Pocock, S. J., Poole, C., Schlesselman, J. J., & Egger, M. (2007). Strengthening the reporting of observational studies in epidemiology (STROBE): Explanation and elaboration. PLoS Medicine, 4(10), e297. doi:10.1371/journal.pmed.0040297
See also
table_continuous() for the transposed shape,
table_categorical() for categorical outcomes.
Examples
table_outcome(sochealth, bmi, select = c(sex, smoking))
#> Descriptive statistics of bmi
#>
#> 95% CI
#> ────────────
#> Variable │ M SD Min Max LL UL n p
#> ─────────────┼─────────────────────────────────────────────────────
#> Overall │ 25.93 3.72 16.00 38.90 25.72 26.14 1188
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> sex │ .018
#> Female │ 25.69 3.78 16.00 38.90 25.39 25.98 616
#> Male │ 26.20 3.64 16.00 37.70 25.90 26.50 572
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> smoking │ .903
#> No │ 25.96 3.76 16.00 38.90 25.72 26.21 915
#> Yes │ 25.93 3.58 16.80 35.30 25.48 26.38 248
#> (Missing) │ 24.74 3.63 17.60 32.50 23.24 26.23 25
#>
#> Note. N = 1200. Missing values removed: bmi (12). P-values: Welch t-test. Each block compares bmi across the levels of one variable, without controlling for the other variables. Overall = the whole analytic sample. CI = confidence interval; LL = lower limit; UL = upper limit.
table_outcome(sochealth, wellbeing_score, select = where(is.factor))
#> Descriptive statistics of wellbeing_score
#>
#> 95% CI
#> ────────────
#> Variable │ M SD Min Max LL UL n p
#> ─────────────────────┼────────────────────────────────────────────────────────
#> Overall │ 69.04 15.62 18.70 100.00 68.16 69.93 1200
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> sex │ <.001
#> Female │ 67.16 14.80 19.60 100.00 65.99 68.33 620
#> Male │ 71.05 16.23 18.70 100.00 69.73 72.37 580
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> age_group │ .372
#> 25-34 │ 67.55 15.36 24.60 100.00 65.60 69.49 242
#> 35-49 │ 69.48 15.36 19.60 100.00 67.94 71.03 383
#> 50-64 │ 69.06 15.94 18.70 100.00 67.33 70.80 327
#> 65-75 │ 69.78 15.84 26.60 100.00 67.80 71.76 248
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> education │ <.001
#> Lower secondary │ 57.22 15.44 18.70 97.90 55.33 59.10 261
#> Upper secondary │ 68.97 13.62 26.70 100.00 67.82 70.12 539
#> Tertiary │ 76.85 13.23 40.40 100.00 75.55 78.15 400
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> social_class │ <.001
#> Lower │ 64.26 14.61 21.10 100.00 61.85 66.66 144
#> Working │ 65.24 15.39 19.60 100.00 63.43 67.06 278
#> Lower middle │ 69.17 16.58 23.70 100.00 67.37 70.98 326
#> Middle │ 72.82 14.13 32.10 100.00 71.23 74.41 306
#> Upper middle │ 72.78 14.95 18.70 100.00 70.33 75.22 146
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> region │ .461
#> Central │ 68.59 15.64 23.70 100.00 66.62 70.56 245
#> East │ 69.69 16.00 30.40 100.00 67.07 72.32 145
#> North │ 69.70 16.04 21.10 100.00 67.48 71.92 203
#> Other │ 70.50 15.07 19.60 100.00 68.39 72.62 198
#> South │ 67.57 15.70 18.70 100.00 65.38 69.75 201
#> West │ 68.51 15.36 29.00 100.00 66.41 70.61 208
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> employment_status │ .049
#> Employed │ 69.42 15.07 19.60 100.00 68.35 70.49 762
#> Student │ 70.42 16.16 18.70 100.00 67.75 73.09 143
#> Unemployed │ 65.78 17.17 23.20 100.00 63.21 68.35 174
#> Inactive │ 69.72 15.64 21.10 100.00 66.90 72.54 121
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> income_group │ .149
#> Low │ 67.66 15.78 21.10 100.00 65.68 69.64 247
#> Lower middle │ 68.78 15.21 23.70 100.00 67.26 70.29 388
#> Upper middle │ 69.18 16.16 19.60 100.00 67.42 70.93 328
#> High │ 70.95 15.51 18.70 100.00 68.89 73.02 219
#> (Missing) │ 67.94 12.41 41.00 93.20 61.77 74.11 18
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> smoking │ .125
#> No │ 69.36 15.62 18.70 100.00 68.36 70.37 926
#> Yes │ 67.65 15.66 21.10 100.00 65.69 69.60 249
#> (Missing) │ 70.99 15.05 42.00 100.00 64.77 77.20 25
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> physical_activity │ .001
#> No │ 67.71 15.92 18.70 100.00 66.48 68.94 650
#> Yes │ 70.61 15.13 21.10 100.00 69.35 71.88 550
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> dentist_12m │ <.001
#> No │ 66.15 14.79 19.60 100.00 64.61 67.70 354
#> Yes │ 70.25 15.81 18.70 100.00 69.18 71.32 846
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> self_rated_health │ <.001
#> Poor │ 43.60 11.15 19.60 70.70 40.74 46.45 61
#> Fair │ 58.54 13.49 18.70 94.30 56.92 60.17 266
#> Good │ 71.58 12.58 26.60 100.00 70.53 72.62 558
#> Very good │ 78.67 12.54 44.20 100.00 77.24 80.11 295
#> (Missing) │ 73.42 11.32 56.30 100.00 68.13 78.72 20
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> bmi_category │ .002
#> Normal weight │ 70.47 15.36 18.70 100.00 69.07 71.87 465
#> Overweight │ 68.78 15.65 19.60 100.00 67.49 70.06 569
#> Obesity │ 65.43 15.84 29.00 100.00 62.91 67.95 154
#> (Missing) │ 72.61 14.84 50.70 97.60 63.18 82.04 12
#> ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
#> institutional_trust │ .366
#> Very low │ 69.84 15.35 23.20 100.00 68.26 71.42 366
#> Low │ 69.35 15.40 24.60 100.00 67.95 70.74 472
#> High │ 67.92 16.17 19.60 100.00 65.83 70.00 234
#> Very high │ 67.69 16.15 18.70 100.00 64.87 70.51 128
#>
#> Note. N = 1200. P-values: Welch t-test (sex, smoking, physical_activity, dentist_12m); Welch one-way ANOVA (age_group, education, social_class, region, employment_status, income_group, self_rated_health, bmi_category, institutional_trust). Each block compares wellbeing_score across the levels of one variable, without controlling for the other variables. Overall = the whole analytic sample. CI = confidence interval; LL = lower limit; UL = upper limit.