Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Binary data
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Data whose unit can take on only two possible states}} {{more citations needed|date=April 2019}} '''Binary data''' is [[data]] whose unit can take on only two possible states. These are often labelled as 0 and 1 in accordance with the [[binary numeral system]] and [[Boolean algebra]]. Binary data occurs in many different technical and scientific fields, where it can be called by different names including ''[[bit]]'' (binary digit) in [[computer science]], ''[[truth value]]'' in [[mathematical logic]] and related domains and ''[[#In statistics|binary variable]]'' in statistics. ==Mathematical and combinatoric foundations== A [[finite set|discrete]] variable that can take only [[one]] state contains zero [[informational entropy|information]], and {{num|2}} is the next [[natural number]] after 1. That is why the [[bit]], a variable with only two possible values, is a standard primary [[units of information|unit of information]]. A collection of {{mvar|n}} bits may have {{math|[[power of two|2<sup>''n''</sup>]]}} states: see [[binary number]] for details. Number of states of a collection of discrete variables depends [[exponential function|exponentially]] on the number of variables, and only as a [[power law]] on number of states of each variable. Ten bits have more ({{num|1024}}) states than three [[decimal digit]]s ({{num|1000}}). {{math|10''k''}} bits are more than sufficient to represent an information (a [[number]] or anything else) that requires {{math|3''k''}} decimal digits, so information contained in discrete variables with [[ternary numeral system|3]], 4, 5, 6, 7, 8, 9, [[Neper|10]]... states can be ever superseded by allocating two, three, or four times more bits. So, the use of any other small number than 2 does not provide an advantage. [[Image:Hypercubeorder binary.svg|thumb|right|A [[Hasse diagram]]: representation of a Boolean algebra as a [[directed graph]]]] Moreover, Boolean algebra provides a convenient mathematical structure for collection of bits, with a semantic of a collection of [[propositional variable]]s. Boolean algebra operations are known as "[[bitwise operation]]s" in computer science. [[Boolean function]]s are also well-studied theoretically and easily implementable, either with [[computer program]]s or by so-named [[logic gate]]s in [[digital electronics]]. This contributes to the use of bits to represent different data, even those originally not binary. =={{anchor|Statistics}}In statistics== In [[statistics]], '''binary data''' is a [[statistical data type]] consisting of [[categorical data]], that can take exactly two possible values, such as "A" and "B", or "heads" and "tails". It is also called '''dichotomous data''', and an older term is '''quantal data'''.{{sfn|Collett|2002|p=1}} The two values are often referred to generically as "success" and "failure".{{sfn|Collett|2002|p=1}} As a form of categorical data, binary data is [[nominal data]], meaning the values are [[qualitative property|qualitatively different]] and cannot be compared numerically. However, the values are frequently represented as 1 or 0, which corresponds to counting the number of successes in a single trial: 1 (success…) or 0 (failure); see {{slink||Counting}}. More intuitively, binary data can be represented as [[count data]]. Often, binary data is used to represent one of two conceptually opposed values, e.g.: *the outcome of an experiment ("success" or "failure") *the response to a yes–no question ("yes" or "no") *presence or absence of some feature ("is present" or "is not present") *the truth or falsehood of a proposition ("true" or "false", "correct" or "incorrect") However, it can also be used for data that is assumed to have only two possible values, even if they are not conceptually opposed or conceptually represent all possible values in the space. For example, binary data is often used to represent the party choices of voters in elections in the United States, i.e. [[Republican Party (United States)|Republican]] or [[Democratic Party (United States)|Democratic]]. In this case, there is no inherent reason why only two [[political party|political parties]] should exist, and indeed, other parties do exist in the U.S., but they are so minor that they are generally simply ignored. Modeling continuous data (or categorical data of more than 2 categories) as a binary variable for analysis purposes is called [[discretization|dichotomization]] (creating a [[dichotomy]]). Like all discretization, it involves [[discretization error]], but the goal is to learn something valuable despite the error: treating it as [[wikt:negligible|negligible]] for the purpose at hand, but remembering that it cannot be assumed to be negligible in general. ==={{anchor|Binary variable}}Binary variables=== A '''binary variable''' is a [[random variable]] of binary type, meaning with two possible values. [[Independent and identically distributed random variables|Independent and identically distributed]] (i.i.d.) binary variables follow a [[Bernoulli distribution]], but in general binary data need not come from i.i.d. variables. Total counts of i.i.d. binary variables (equivalently, sums of i.i.d. binary variables coded as 1 or 0) follow a [[binomial distribution]], but when binary variables are not i.i.d., the distribution need not be binomial. ===Counting=== Like categorical data, binary data can be converted to a [[Array data structure|vector]] of [[count data]] by writing one coordinate for each possible value, and counting 1 for the value that occurs, and 0 for the value that does not occur.<ref>{{cite book |last=Agresti |first=Alan |url=https://books.google.com/books?id=UOrr47-2oisC&pg=PA6 |title=Categorical Data Analysis |publisher=Wiley |year=2012 |isbn=978-0470463635 |edition=3rd |page=6 |section=1.2.2 Multinomial Distribution}}</ref> For example, if the values are A and B, then the data set A, A, B can be represented in counts as (1, 0), (1, 0), (0, 1). Once converted to counts, binary data can be [[grouped data|grouped]] and the counts added. For instance, if the set A, A, B is grouped, the total counts are (2, 1): 2 A's and 1 B (out of 3 trials). Since there are only two possible values, this can be simplified to a single count (a scalar value) by considering one value as "success" and the other as "failure", coding a value of the success as 1 and of the failure as 0 (using only the coordinate for the "success" value, not the coordinate for the "failure" value). For example, if the value A is considered "success" (and thus B is considered "failure"), the data set A, A, B would be represented as 1, 1, 0. When this is grouped, the values are added, while the number of trial is generally tracked implicitly. For example, A, A, B would be grouped as 1 + 1 + 0 = 2 successes (out of <math>n = 3</math> trials). Going the other way, count data with <math>n = 1</math> is binary data, with the two classes being 0 (failure) or 1 (success). Counts of i.i.d. binary variables follow a binomial distribution, with {{tmath|n}} the total number of trials (points in the grouped data). ===Regression=== {{main|Binary regression}} [[Regression analysis]] on predicted outcomes that are binary variables is known as [[binary regression]]; when binary data is converted to count data and modeled as i.i.d. variables (so they have a binomial distribution), [[binomial regression]] can be used. The most common regression methods for binary data are [[logistic regression]], [[probit regression]], or related types of [[binary choice]] models. Similarly, counts of i.i.d. categorical variables with more than two categories can be modeled with a [[multinomial regression]]. Counts of non-i.i.d. binary data can be modeled by more complicated distributions, such as the [[beta-binomial distribution]] (a [[compound distribution]]). Alternatively, the ''relationship'' can be modeled without needing to explicitly model the distribution of the output variable using techniques from [[generalized linear model]]s, such as [[quasi-likelihood]] and a [[quasibinomial]] model; see {{slink|Overdispersion|Binomial}}. ==In computer science== [[File:Commons QR code.png|thumb|right|A [[binary image]] of a [[QR code]], representing 1 bit per pixel, as opposed to a typical 24-bit [[Color depth#True color (24-bit)|true color]] image.]] {{See also|Binary file}} In modern [[computer]]s, binary data refers to any data represented in binary form rather than interpreted on a higher level or [[Data conversion|converted]] into some other form. At the lowest level, bits are stored in a [[bistability|bistable]] device such as a [[flip-flop (electronics)|flip-flop]]. While most binary data has [[symbol]]ic meaning (except for [[don't care]]s) not all binary data is numeric. Some binary data corresponds to [[Instruction (computer science)|computer instruction]]s, such as the data within [[processor register]]s decoded by the [[control unit]] along the [[fetch-decode-execute cycle]]. Computers rarely modify individual bits for performance reasons. Instead, data is [[data structure alignment|aligned]] in groups of a fixed number of bits, usually 1 [[byte]] (8 bits). Hence, "binary data" in computers are actually sequences of bytes. On a higher level, data is accessed in groups of 1 [[word (computer architecture)|word]] (4 bytes) for [[32-bit]] systems and 2 words for [[64-bit]] systems. In applied [[computer science]] and in the [[information technology]] field, the term ''binary data'' is often specifically opposed to ''[[text-based data]]'', referring to any sort of data that cannot be interpreted as [[text-based format|text]]. The "text" vs. "binary" distinction can sometimes refer to the semantic content of a file (e.g. a written document vs. a [[digital image]]). However, it often refers specifically to whether the individual bytes of a file are interpretable as text (see [[character encoding]]) or cannot so be interpreted. When this last meaning is intended, the more specific terms ''binary format'' and ''text(ual) format'' are sometimes used. Semantically textual data can be represented in binary format (e.g. when compressed or in certain formats that intermix various sorts of formatting codes, as in the [[doc (computing)|doc format]] used by [[Microsoft Word]]); contrarily, image data is sometimes represented in textual format (e.g. the [[X PixMap]] image format used in the [[X Window System]]). 1 and 0 are nothing but just two different voltage levels. You can make the computer understand 1 for higher voltage and 0 for lower voltage. There are many different ways to store two voltage levels. If you have seen floppy, then you will find a magnetic tape that has a coating of ferromagnetic material, this is a type of paramagnetic material that has domains aligned in a particular direction to give a remnant magnetic field even after removal of currents through materials or magnetic field. During loading of data in the magnetic tape, the magnetic field is passed in one direction to call the saved orientation of the domain 1 and for the magnetic field is passed in another direction, then the saved orientation of the domain is 0. In this way, generally, 1 and 0 data are stored.<ref>{{Cite web |last=Gul |first=Najam |date=2022-08-18 |title=How do different types of Data get stored in form of 0 and 1? |url=https://www.deepcurious.com/how-do-different-types-of-data-get-stored-in-form-of-0-and-1 |access-date=2023-01-05 |website=Curiosity Tea |language=en}}</ref> ==See also== * [[Bit array]] * [[Binary protocol]] * [[Bernoulli distribution]] * [[Boolean data type]] * [[Computer memory]] * [[Categorical data]] * [[Qualitative data]] ==References== {{reflist}} {{refbegin}} * {{cite book |title=Modelling Binary Data |first=David |last=Collett |year=2002 |publisher=CRC Press |edition=Second |isbn=9781420057386}} {{refend}} [[Category:Statistical data types]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Anchor
(
edit
)
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Main
(
edit
)
Template:Math
(
edit
)
Template:More citations needed
(
edit
)
Template:Mvar
(
edit
)
Template:Num
(
edit
)
Template:Refbegin
(
edit
)
Template:Refend
(
edit
)
Template:Reflist
(
edit
)
Template:See also
(
edit
)
Template:Sfn
(
edit
)
Template:Short description
(
edit
)
Template:Slink
(
edit
)
Template:Tmath
(
edit
)