A dichotomous variable is a variable with exactly two mutually exclusive categories, such as yes/no, present/absent, or completed/not completed. It may occur naturally or be created from another variable. Researchers commonly summarize it with counts and proportions and analyze it using methods such as chi-square tests, logistic regression, or McNemar’s test.

Introduction
Dichotomous variables are common in surveys, experiments, clinical studies, educational research, epidemiology, psychology, economics, and data science. Researchers use them to record whether an event occurred, whether a condition was present, whether a participant received an intervention, or whether a response met a specified criterion.
Although a two-category variable appears simple, several decisions affect its validity and interpretation. Researchers must define the two categories clearly, distinguish missing data from a genuine response, choose a meaningful reference category, and select an analysis that matches the study design.
This article explains what a dichotomous variable is, how it differs from related variable types, how it is coded and analyzed, and why converting a continuous measure into two groups can sometimes produce misleading results.
Key Takeaways
- A dichotomous variable has exactly two valid categories.
- The categories should be mutually exclusive and collectively cover the valid responses defined by the study.
- Dichotomous and binary are usually used as synonyms, although related terms such as dummy, indicator, Boolean, and Bernoulli have more specific contexts.
- Coding categories as 0 and 1 is convenient but does not change the underlying variable into a continuous measurement.
- The correct statistical method depends on whether the variable is an outcome or predictor and whether observations are independent, paired, repeated, or clustered.
- Artificially splitting a continuous variable into “low” and “high” groups usually loses information and should not be done without a defensible threshold.
What Is a Dichotomous Variable?
A dichotomous variable is a categorical variable that permits exactly two valid outcomes for each observation.
For example, a university study may record whether each student completed a course:
- Completed
- Did not complete
Each student can belong to only one of these categories for the period being studied. Together, the two categories cover all valid completion outcomes.
The word dichotomous comes from the idea of dividing something into two parts. In research, however, the categories do not always have to be literal opposites. “Intervention group” and “control group,” for example, can form a valid dichotomous variable because there are two defined study groups.
Essential Characteristics of a Dichotomous Variable
A valid dichotomous variable normally has the following characteristics.
It has exactly two valid categories
A variable containing “yes,” “no,” and “uncertain” has three substantive response categories and is not dichotomous unless “uncertain” is treated as missing for a justified reason.
The categories are mutually exclusive
Each observation should belong to only one category at a given measurement occasion. A participant cannot simultaneously be coded as both “completed” and “did not complete” for the same course and period.
The categories cover the defined valid outcomes
The categories should account for every valid response described in the operational definition. Missing, refused, and not-applicable responses may exist, but they should be stored separately rather than forced into one of the substantive categories.
The variable may be an outcome or a predictor
A dichotomous variable can serve as:
- An outcome, such as whether a patient recovered.
- A predictor, such as whether a participant received an intervention.
- A control variable, such as whether data came from site A or site B.
- A grouping variable, such as online versus classroom instruction.
The category labels may be words or numbers
The values may be recorded as:
- Yes and no
- Present and absent
- True and false
- 0 and 1
- A and B
The meaning comes from the labels and codebook, not from the numerical symbols alone.
Naturally Dichotomous and Constructed Dichotomous Variables
Dichotomous variables can be divided into two broad types.
Naturally dichotomous variables
A naturally dichotomous variable describes an observation that is defined with two possible states in the research context.
Examples include:
- A payment was received or was not received.
- A device passed or failed a specified safety test.
- A participant was assigned to the intervention or control condition.
- A recorded event occurred or did not occur during follow-up.
- A survey respondent gave or did not give consent.
“Natural” does not mean that the concept can never be defined differently. It means that the two-category form directly matches the operational definition used in that study.
Constructed or artificially dichotomous variables
A constructed dichotomous variable is created by grouping values from another variable into two categories.
Suppose an assessment score ranges from 0 to 100. A researcher might create:
- 1 = score of 70 or higher
- 0 = score below 70
The resulting pass/fail variable is dichotomous, but the original score is not. The dichotomy depends on the selected threshold.
Constructed variables are sometimes necessary for formal decisions, eligibility criteria, diagnoses, or policy rules. However, an arbitrary threshold can discard meaningful variation and should not replace the original measure without a clear justification.
Examples and Non-Examples
| Variable | Categories or values | Dichotomous? | Explanation |
|---|---|---|---|
| Informed consent | Given / not given | Yes | Two valid states |
| Study condition | Intervention / control | Yes | Two defined groups |
| Test result | Positive / negative | Yes, if inconclusive results are handled separately | Exactly two valid classified results |
| Course completion | Completed / not completed | Yes | Two outcomes |
| Employment status | Employed / unemployed / student / retired | No | More than two categories |
| Satisfaction | Satisfied / dissatisfied | Yes | Two categories, although the construct may have been simplified |
| Satisfaction scale | Very dissatisfied to very satisfied on five points | No | Five ordered categories |
| Examination score | 0–100 | No | Quantitative, not dichotomous |
| Examination classification | Pass / fail | Yes | Created using a threshold |
| Number of publications | 0, 1, 2, 3, … | No | Discrete count with more than two possible values |
| Survey response | Yes / no / prefer not to answer | Usually no as stored | Contains a third recorded category unless nonresponse is designated missing |
| Checkbox items | Selected / not selected for each option | Each item may be dichotomous | Multiple indicators can each be binary even though respondents may select several options |
Dichotomous Variable Versus Related Terms
Dichotomous variable versus binary variable
In most research and statistical contexts, dichotomous variable and binary variable are synonyms. Both describe a variable with two possible categories or states.
The word binary often emphasizes representation, particularly 0/1 coding in statistics, computing, and machine learning. Dichotomous often emphasizes the division of observations into two categories.
It is therefore usually unnecessary to claim that one is always a subtype of the other. Terminology varies among disciplines and textbooks.
Dichotomous variable versus dummy variable
A dummy variable is an indicator created for statistical modeling, usually with values 0 and 1.
Suppose a region variable has four categories:
- North
- South
- East
- West
A regression model may represent it using several dummy variables, such as:
- South: 1 if South, 0 otherwise
- East: 1 if East, 0 otherwise
- West: 1 if West, 0 otherwise
Each dummy variable is dichotomous, but the original region variable is not.
Dichotomous variable versus indicator variable
An indicator variable records whether a specified condition is true:
[
I(A)=
\begin{cases}
1, & \text{if event } A \text{ occurs} \
0, & \text{otherwise}
\end{cases}
]
Indicator variables are a mathematical and modeling form of dichotomous variable.
Dichotomous variable versus Boolean variable
A Boolean variable uses the values TRUE and FALSE. The term is especially common in programming and database systems. It is functionally binary, although software may store it differently from an integer-coded 0/1 variable.
Dichotomous variable versus nominal variable
Most dichotomous variables are treated as nominal when the two category labels do not represent a meaningful rank.
Examples include:
- Control / intervention
- Site A / site B
- Selected / not selected
A dichotomous variable is therefore often described as a special case of a nominal categorical variable.
Can a dichotomous variable be ordinal?
A two-category variable may have an order, such as:
- Fail / pass
- Low risk / high risk
- Incorrect / correct
It can therefore be described as ordinal in a conceptual sense. In many analyses, however, two ordered categories are handled with the same binary procedures used for nominal two-category outcomes.
Researchers should describe the substantive meaning of the categories instead of relying only on a measurement-level label.
Dichotomous variable versus discrete variable
A discrete variable takes separate, countable values. A dichotomous variable is discrete because it has two distinct possibilities.
However, not every discrete variable is dichotomous. The number of children in a household is discrete but may take many values.
Dichotomous variable versus continuous variable
A continuous variable can take values across an interval, such as height, time, temperature, or a scale score.
A dichotomous variable has only two recorded categories. Converting a continuous variable into two groups changes the information available for analysis; it does not prove that the original characteristic naturally existed in two states.
How Are Dichotomous Variables Coded?
Dichotomous variables are often coded as 0 and 1:
- 0 = reference, absence, or comparison state
- 1 = event, presence, or focal state
For example:
| Variable name | Label | Value | Meaning |
|---|---|---|---|
completed | Course completed | 0 | Did not complete |
completed | Course completed | 1 | Completed |
completed | Course completed | Missing | Outcome unavailable |
Why 0/1 coding is useful
With valid 0/1 coding:
- The sum equals the number of observations coded 1.
- The arithmetic mean equals the sample proportion coded 1.
- Regression coefficients have convenient reference-category interpretations.
- Most statistical software recognizes the structure easily.
Is 0/1 coding compulsory?
No. A dichotomous variable may be stored as yes/no, 1/2, A/B, or true/false.
However, 0/1 coding is often convenient. Whatever codes are used, the researcher must document:
- Which category is the event.
- Which category is the reference.
- How missing values are represented.
- Whether the coding was reversed during analysis.
Does 1 mean “better” than 0?
Not necessarily. The values are labels unless the research definition gives them a directional meaning.
For an adverse outcome, 1 might represent failure, disease, default, or dropout. Researchers should never assume that 1 automatically means a desirable result.
Mathematical Representation
A 0/1 dichotomous random variable is commonly modeled as a Bernoulli variable.
Let:
[
X =
\begin{cases}
1, & \text{with probability } p \
0, & \text{with probability } 1-p
\end{cases}
]
Then:
[
E(X)=p
]
and:
[
\operatorname{Var}(X)=p(1-p)
]
For a sample of (n) observations, the sample mean is:
[
\bar{X}=\frac{\sum_{i=1}^{n}X_i}{n}=\hat{p}
]
Thus, when a variable is coded 0 and 1, its mean is the observed proportion of cases coded 1.
For example, if 72 of 100 participants completed a programme, the mean of the 0/1 completion variable is:
[
\bar{X}=\frac{72}{100}=0.72
]
The observed completion proportion is therefore 0.72, or 72%.
How to Identify a Dichotomous Variable in a Dataset
Use the following process.
Step 1: Read the operational definition
Determine what the variable is intended to measure. A column with the numbers 0 and 1 could represent a binary outcome, but the numbers could also have been entered incorrectly or used as category identifiers.
Step 2: Inspect unique values
List all distinct recorded values, including unusual labels and user-defined missing codes.
A variable containing 0, 1, and 99 may still be analytically dichotomous if 99 is explicitly defined as missing. It is not safe to assume this without consulting the codebook.
Step 3: Separate substantive responses from missingness
Identify:
- System missing
- Unknown
- Refused
- Not applicable
- Not measured
- Invalid response
Do not recode these automatically as 0.
Step 4: Check mutual exclusivity
Confirm that each observation can belong to only one category at the same time and level of analysis.
Step 5: Check that the categories fit the construct
Ask whether the two categories accurately represent the phenomenon or create a false dichotomy.
Step 6: Confirm the event and reference categories
In logistic regression and related models, changing the event or reference category changes the direction of coefficients and odds ratios.
Step 7: Review frequency counts
Inspect the number and percentage in each category. Extremely rare outcomes may require special estimation, larger samples, simplified models, or exact methods.
How to Summarize a Dichotomous Variable
The most useful descriptive statistics are:
- Frequency in each category.
- Percentage or proportion in each category.
- Number of missing observations.
- Confidence interval for the proportion when inferential reporting is needed.
Because the two valid proportions sum to 1, reporting one category’s proportion determines the other. Nevertheless, a table may show both categories for readability.
Example
| Completion outcome | Frequency | Percentage |
|---|---|---|
| Completed | 280 | 70% |
| Did not complete | 120 | 30% |
| Valid total | 400 | 100% |
| Missing | 8 | Reported separately |
The denominator used for the percentage should be stated. In this example, percentages are based on the 400 valid observations rather than all 408 records.
How to Visualize a Dichotomous Variable
Useful visualizations include:
- A bar chart of counts.
- A bar chart of proportions.
- A grouped or stacked bar chart when comparing groups.
- A dot-and-whisker plot for estimated proportions or effects with confidence intervals.
- A mosaic plot for relationships between categorical variables.
A histogram is generally not the most informative choice because a dichotomous variable has only two category values.
Pie charts can display two proportions, but bar charts usually make comparisons and small differences easier to judge.
Which Statistical Test Should Be Used?
The correct method depends on the research question, the role of the dichotomous variable, the type of the other variables, and whether observations are independent or related.
| Research situation | Common method | Main quantity of interest |
|---|---|---|
| One dichotomous variable compared with a hypothesized proportion | Exact binomial test or one-proportion procedure | Proportion and confidence interval |
| Two independent categorical variables | Chi-square test of independence | Association; report proportions and an effect measure |
| Sparse 2 × 2 table | Fisher’s exact test or another exact method | Exact evidence of association |
| Paired binary measurements | McNemar’s test | Change in discordant pairs |
| Binary outcome with one or more predictors | Binary logistic regression | Predicted probability and odds ratios |
| Continuous outcome compared across two binary groups | Welch’s t test or linear regression, when appropriate | Difference in means |
| Natural dichotomy associated with a continuous variable | Point-biserial/Pearson correlation or regression | Strength and direction of association |
| Two dichotomous variables summarized as a correlation | Phi coefficient; tetrachoric correlation only under a latent-variable model | Association |
| Repeated binary outcomes | Generalized estimating equations or mixed-effects logistic regression | Population-average or subject-specific association |
| Time until an event, with censoring | Survival-analysis methods | Time-to-event effect, not merely event yes/no |
The table is a guide rather than a substitute for checking assumptions, sampling design, clustering, missing data, and the estimand required by the research question.
Dichotomous Variables as Outcomes
A dichotomous dependent variable records which of two outcomes occurred.
Examples include:
- Completed or did not complete.
- Admitted or not admitted.
- Event occurred or did not occur.
- Correct or incorrect.
- Purchased or did not purchase.
Why ordinary linear regression is usually not the default
A binary outcome violates several assumptions associated with a standard continuous-outcome linear model. Fitted values can also fall below 0 or above 1.
Binary logistic regression instead models the log odds of the event:
[
\log\left(\frac{p}{1-p}\right)
\beta_0+\beta_1X_1+\cdots+\beta_kX_k
]
The transformed model keeps predicted probabilities within the 0-to-1 range.
Other binary-outcome models, such as probit regression or a log-link model, may be appropriate depending on the estimand and data.
Dichotomous Variables as Predictors
A dichotomous independent variable can be included in many models.
Suppose:
- 0 = control
- 1 = intervention
In a linear regression predicting a continuous outcome:
[
Y=\beta_0+\beta_1X+\varepsilon
]
- (\beta_0) is the estimated mean for the control group.
- (\beta_1) is the estimated difference between the intervention and control means.
In logistic regression, the exponentiated coefficient:
[
e^{\beta_1}
]
is an odds ratio comparing the group coded 1 with the reference group coded 0, conditional on other variables in the model.
Reversing the coding reverses the comparison. It does not change the underlying fit when the model is otherwise identical, but it changes coefficient signs and turns an odds ratio into its reciprocal.
Understanding Proportions, Risks, Odds and Odds Ratios
These quantities are related but not interchangeable.
Proportion or risk
If 20 of 100 participants experience an event:
[
p=\frac{20}{100}=0.20
]
The observed risk is 20%.
Odds
The odds compare events with non-events:
[
\text{odds}=\frac{p}{1-p}
]
For a risk of 0.20:
[
\text{odds}=\frac{0.20}{0.80}=0.25
]
This means one event for every four non-events.
Risk difference
If the event risk is 20% in one group and 10% in another:
[
RD=0.20-0.10=0.10
]
The absolute risk difference is 10 percentage points.
Risk ratio
[
RR=\frac{0.20}{0.10}=2.0
]
The first group has twice the observed risk.
Odds ratio
[
OR=
\frac{0.20/0.80}{0.10/0.90}
2.25
]
The odds ratio is 2.25, which is not the same as the risk ratio of 2.0.
An odds ratio of 2 does not mean that probability doubled in every situation. Interpretation should specify that it refers to odds, and predicted probabilities or absolute risks should be provided when they are more understandable.
Advantages of Dichotomous Variables
Clear interpretation
Two categories can be easy to communicate to students, practitioners, decision-makers, and the public.
Direct connection to decisions
Many decisions are inherently binary at the point of action, such as eligible/not eligible or approve/reject.
Efficient data collection
A well-designed yes/no item may reduce respondent burden when a graded response is unnecessary.
Compatibility with established models
Statistical methods for binary outcomes are widely available in standard software.
Useful indicator construction
Dichotomous indicators make it possible to represent categorical memberships, policy conditions, treatment assignments, and event occurrence in regression models.
Limitations of Dichotomous Variables
Limited detail
A two-category measure cannot represent severity, intensity, frequency, duration, or uncertainty unless those features are collected separately.
Sensitivity to definitions
A constructed dichotomy may change substantially when the threshold changes.
Misclassification
Measurement errors near a cut point can place similar observations into different categories.
Imbalanced outcomes
When nearly all observations fall in one category, estimates may be imprecise and prediction metrics such as overall accuracy can be misleading.
Potentially misleading simplicity
A binary label may conceal heterogeneous cases within each group.
Specialized analysis
Binary outcomes require methods that account for their distribution, sampling design, dependence, and link function.
Why Arbitrary Dichotomization Is Usually Discouraged
Dichotomization is the conversion of a variable with several or many possible values into two categories.
For example, a researcher may divide a continuous anxiety score into:
- Low anxiety
- High anxiety
using the sample median.
This may appear to simplify analysis, but it creates several problems.
It discards information
Participants with meaningfully different scores may be placed in the same group, while participants with nearly identical scores on opposite sides of the threshold are placed in different groups.
It can reduce statistical power
Methodological research has shown that dichotomizing quantitative variables can make genuine relationships harder to detect. A median split can impose a substantial efficiency loss compared with retaining the continuous information (Cohen, 1983; MacCallum et al., 2002; Altman & Royston, 2006).
It makes findings depend on the cut point
Different thresholds may produce different estimates, significance tests, and conclusions.
It can distort functional relationships
A gradual or nonlinear association may be misrepresented as a simple difference between two groups.
It can create residual confounding
When a continuous confounder is reduced to two categories, substantial variation may remain uncontrolled within each category.
It can reduce comparability
Studies using different thresholds may report apparently incompatible results even when their underlying continuous patterns are similar.
When May Dichotomization Be Justified?
Dichotomization may be defensible when:
- The outcome is inherently defined by two states.
- A validated clinical, legal, regulatory, or operational threshold exists.
- The research question concerns a real decision made at that threshold.
- The cut point was specified before examining the outcome data.
- The original variable is retained and reported.
- Sensitivity analyses examine whether conclusions depend on the threshold.
- Both continuous and decision-based results are useful for different purposes.
A sample median is usually not a substantive threshold. It changes from sample to sample and does not necessarily correspond to a meaningful distinction.
Handling Missing, Unknown and Not-Applicable Values
Missingness is not automatically a third substantive category, but it is also not equivalent to either valid category.
Consider:
- 1 = Yes
- 0 = No
- 9 = Unknown
- 8 = Not applicable
- Blank = Not recorded
Before analysis, 8 and 9 should normally be defined as special missing or separately meaningful values according to the study protocol.
Do not code missing as 0
Coding an unavailable response as “no” changes the observed event proportion and can bias associations.
Distinguish structural from ordinary missingness
“Not applicable” may reflect study logic rather than failure to respond. For example, a follow-up question may not apply to participants who answered no to a previous screening item.
Report the denominator
State whether percentages use:
- All sampled participants.
- All eligible participants.
- Complete cases.
- Respondents with a valid value for that variable.
Investigate missing-data mechanisms
The appropriate treatment depends on why values are missing, what other variables are available, and what assumptions the analysis can support. A single universal recoding rule is not adequate.
Common Mistakes
Treating every 0/1 column as valid binary data
The codes may include undocumented missing values, import errors, or multiple meanings.
Assuming 0 and 1 are numerical quantities
They usually represent category membership. Arithmetic interpretations should be based on the statistical model, not the labels alone.
Coding unknown as no
This combines nonresponse with a substantive outcome.
Failing to identify the event category
Software may model the first, last, lower, or higher category depending on settings.
Using an arbitrary median split
This sacrifices information without necessarily creating a meaningful classification.
Reporting only a p value
Readers also need counts, denominators, proportions, effect estimates, confidence intervals, and the direction of comparison.
Interpreting odds ratios as risk ratios
The two measures can differ substantially when an outcome is common.
Ignoring paired or clustered observations
A standard chi-square test or ordinary logistic regression may be inappropriate when observations come from the same person, household, classroom, hospital, or study site.
Treating time-to-event data as simple binary data
Whether an event occurred does not capture follow-up duration or censoring.
Using overall accuracy for a highly imbalanced outcome
A model can achieve high accuracy by predicting the majority category for almost every case. Sensitivity, specificity, precision, calibration, and other measures may be needed.
Uses in Modern Research
Survey research
Dichotomous variables record yes/no behavior, awareness, consent, eligibility, or item selection. Survey designers should offer additional responses when uncertainty, refusal, or non-applicability is substantively meaningful.
Experimental research
Treatment assignment is often represented by a binary indicator. Outcomes may also be binary, such as task success or event occurrence.
Clinical and epidemiological research
Researchers analyze diagnosis status, treatment response, exposure status, test results, and event occurrence. Threshold-based classifications should use clinically or scientifically defensible criteria.
Educational research
Examples include correct/incorrect items, completion, attendance status, pass/fail classifications, and intervention assignment.
A collection of correct/incorrect test items may require psychometric methods designed for dichotomous items rather than treating each item as an unrelated yes/no variable.
Social and behavioral research
Binary variables may represent participation, policy exposure, observed behavior, or response to a screening item. Researchers should avoid forcing complex identities or multidimensional constructs into two categories when the binary representation is not theoretically justified.
Machine learning
Binary classification predicts one of two target classes. The target variable is dichotomous, but the model’s output is often a probability that is converted to a class using a threshold.
The classification threshold should be selected according to the practical costs of false positives and false negatives, not automatically assumed to be 0.50.
Digital Research Tools and Artificial Intelligence
Statistical software can recode, summarize, visualize, and model dichotomous variables. Common tools include SPSS, R, Python, Stata, SAS, jamovi, JASP, and spreadsheet software.
Artificial-intelligence assistants can help researchers draft code, identify inconsistent labels, create codebook entries, and explain statistical output. However, AI-generated transformations should be checked against the actual dataset and protocol.
AI systems may:
- Reverse 0 and 1.
- Treat missing values as no.
- select an inappropriate reference category.
- recommend a test without recognizing paired or clustered data.
- produce syntactically valid but substantively incorrect code.
- invent interpretations not supported by the output.
Researchers should preserve an auditable script, validate frequency tables before and after recoding, and document every transformation.
Recoding Examples
R
library(dplyr)
valid_labels <- c("Yes", "No")
unexpected <- setdiff(na.omit(unique(df$completed)), valid_labels)
if (length(unexpected) > 0) {
stop(
paste("Unexpected labels:", paste(unexpected, collapse = ", "))
)
}
df <- df |>
mutate(
completed01 = recode(
completed,
"No" = 0L,
"Yes" = 1L,
.default = NA_integer_
)
)
table(df$completed, df$completed01, useNA = "ifany")
This code validates the source labels before creating the new variable.
Python with pandas
import pandas as pd
mapping = {"No": 0, "Yes": 1}
observed = set(df["completed"].dropna().unique())
unexpected = observed - set(mapping)
if unexpected:
raise ValueError(f"Unexpected labels: {sorted(unexpected)}")
df["completed01"] = (
df["completed"]
.map(mapping)
.astype("Int64")
)
print(
pd.crosstab(
df["completed"],
df["completed01"],
dropna=False
)
)
The nullable Int64 type allows the recoded variable to retain missing values.
SPSS
RECODE completed
('No' = 0)
('Yes' = 1)
(ELSE = SYSMIS)
INTO completed01.
VARIABLE LABELS
completed01 'Course completed: 0=No, 1=Yes'.
VALUE LABELS completed01
0 'No'
1 'Yes'.
FREQUENCIES VARIABLES=completed completed01.
The frequency output should be inspected before the recoded variable is used in an inferential analysis.
Reporting Checklist
When reporting a dichotomous variable, include:
- The operational definition.
- The two category labels.
- The numerical coding, when relevant.
- The event and reference categories.
- Counts and percentages.
- The number of missing observations.
- The denominator used for each percentage.
- The reason for any constructed threshold.
- The statistical model or test.
- An appropriate effect estimate.
- A confidence interval.
- Any adjustment variables.
- The handling of clustering, repeated measurements, or weighting.
- Sensitivity analyses when results depend on a threshold.
- Access to the analysis code or transformation rules when possible.
Conclusion
A dichotomous variable classifies observations into exactly two valid categories. Its apparent simplicity does not remove the need for careful definition, coding, validation, analysis, and reporting.
Researchers should distinguish valid responses from missingness, specify the event and reference categories, and choose statistical methods that match the study design. When the variable is created from a continuous measure, the threshold must be justified because arbitrary dichotomization can reduce information, power, and interpretability.
