




















Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!





















Statistics – notes
Statistics describe phenomena via an approximation of reality, through data collection,
sampling, definition of variable measurements, etc… It was born during positivism, when the
experimental method used since Galileo Galilei’s time started to be applied not only to the
hard sciences but also to the social ones. However, conclusions were not drawn from
experiments, but from data.
Statistics can be descriptive , so they describe what happens in the data without generalizing
or making predictions about it; or they can be inferential , so they describe a sample to draw
conclusions for the whole population which would be too expensive to analyze fully. The
sample must be representative of the population, but in any case, the error must be
calculated since it is only a prediction carried out via probability.
Statistics can be univariate, so that analyze only one variable at a time, or bivariate, which
study the relationship between two variables (association, variance/anova, correlation,
regression, etc…)
Univariate statistics: describing a single variable
Measurement is the task of gathering information that characterizes or represents a social
phenomenon. Data can be gathered via:
it is time-consuming and expensive if the sample is big. Plus, the complexity of a
throughout analysis makes comparisons difficult. It can be useful for ‘text mining’, a
complex process which aims to compare the vocabulary used by respondents to
describe and perceive a certain phenomenon.
information about a large number of subjects, in a comparable form. However, it
results in simplification of information since much detail is lost.
The units of analysis are the type of thing which we are gathering information about, such as
people, organization, countries, etc… Units of analysis are different from simple units, such
as km or miles.
Measurement can involve different measurement scales :
in the category have a commonality), mutually exclusive (people can fit in only one
category), exhaustive (there is a category for everybody, even if it is ‘none of the above’
or ‘other’). If a person falls into multiple categories, the survey must be modified to
accommodate their choice, or they can be forced to choose among categories or
choosing for them. The only operation that can be carried out is defining whether two
elements are equal or not.
exclusive and ordered. While nominal scales cannot be meaningfully ordered, ordinal
scales can, though we cannot know how big the difference is between ranks due to
department ranking.
homogenous, ordered and measured in comparable units which allow for the
application of all numerical operations among them. They can be discrete (take on only
specific values like integers due to approximation and simplification) or continuous
(measured with arbitrary precision, but difficult to use to produce useful plots).
The validity of a measurement is the degree to which a measurement captures what it is
intended to. If validity is very poor, measurements become meaningless.
The reliability of a measurement is the extent to which a measure produces consistent
results. If reliability is very poor, measures become meaningless.
Collecting data in a study
A sample survey is the process of sampling people from a population and interviewing them,
while an experiment entails comparing response of subjects under different conditions, with
subjects assigned to conditions.
Randomization is the mechanism for achieving reliable data by reducing potential bias. If n is
the sample size, in a simple random sample, each possible sample of size n has the same
chance of being selected. This is an example of a probability sampling method, which can be
systematic, stratified, cluster or random sampling.
To implement random sampling, random number tables or statistical software must be used
to generate random numbers among a sampling frame, the list of all subjects in a population.
A finite population includes:
For non-probability sampling, we cannot specify probabilities from the possible samples and
inferences based on them can be highly unreliable. An example is represented by volunteer
samples, like internet polls or medical studies.
Experimental studies are based onto the notion that researchers assign subjects to
experimental conditions. Randomization ‘balances’ treatment groups with respect to other
variables that could affect response. It makes it easier to assess cause and effect.
On the other hand, sample surveys are examples of observational studies, since the study is
carried out without experimental manipulation.
information in the process. However, it is to be highlighted that information is destroyed in
the process. It results in a histogram , where the height of the bars represents the number of
cases within a given range of values or an interval. An interval can be closed or open: closed
intervals are represented as (vi; vi + 1].
In a histogram, since difference frequencies are grouped in intervals, we need to also
consider the density (ni/δi) , so the ratio between the absolute frequency in that range and
the number of units in the chosen class, so the class width (distance between the end of the
interval and the beginning). The density can be represented in the height bar of a histogram
instead of the frequency and it is especially useful for continuous, grouped variables and
values.
In STATA, ‘histogram (category), discrete width (width of the interval in numbers)’.
Measures of central tendency
The mean/average ȳ for the sample or My for the population is the sum of the observations
divided by the number of observations (ȳ = ( S or y 1
+ y 2
+ ... + y n
)/n). The symbol S represents
the sum of all the y values.
The properties of the mean include the fact that it is only appropriate for quantitative
variables and that it is highly influenced by outliers, or values much above or below the
majority of data.
If we consider the weighted average for two sets of data, the overall sample mean is
obtained though the formula 𝑦" =
!"#"$!% #%
'''''''''''''''
!"$!%
where the numerator is the sum of all
observations and the denominator is the total sample size.
The arithmetic mean of a variable is always included between the minimum value and the
maximum value assumed by the variable itself, that is x min £ x £ x max.
The average of a constant is equal to the constant itself, furthermore if a variable X is
multiplied by a constant its average is also multiplied by the same constant, that is
M(a+bX)=a+bM(X).
The algebraic sum of the deviations of the xi values from their arithmetic mean is equal to 0.
Theorems of the mean
Theorem 2
The arithmetic mean of the sum (or difference) of two (or more variables) is equal to the
sum (or difference) of the arithmetic mean of the individual variables.
The median Me splits the sample into two parts with equal numbers of observations, so it is
the observation the falls in the middle of the ordered sample. When the sample size n is odd,
the median is a single observation, while if the sample size n is even, the median falls
between the two middle observations.
The formula of the median when the number of values is odd is (n+1/2) while when n is even
is both (n/2) and (n/2+1) : the median value falls in between the two numbers when the
variable is quantitative.
Among its properties, we can say that the mean is appropriate for quantitative variables as
well as ordered variables, but not for qualitative data. For symmetrical distributions, the
mean and the median are identical, while for skewed distributions the mean lies toward the
longer tail relative to the median.
The mode Mo is the value that occurs most frequently, which is the easiest measure to
evaluate the center of qualitative variables. The mode is appropriate for all types of data. A
frequency can be bimodal, if two distinct values have the same highest frequency, especially
common if a population is polarized.
It can be misleading if there are many similar peaks in the data.
In case of grouped data, the mode is the average of the class with the highest density.
Skewness refers to the symmetry of a distribution, often used descriptively without calculus,
by eye.
position index: variance, standard deviation, coefficient of variation, etc…
Heterogeneity or impurity indexes
They are based on relative frequency fi or percentage pi and are used for nominal scales.
They are always positive and reach their maximum when each category assumes the same
relative frequency fi=1/k for each I, when k is the number of categories. They assume the
minimum when one frequency fi is equal to 1 and all the others (k-1) are equal to zero.
Gini index assumes values between 0 min and (k-1)/k max, which is often normalized at 1.
Shannon’s diversity index or entropy assumes values between 0 min and log(K) max,
normalized between 0 and 1.
Interpreting dispersion
Some measures of dispersion are:
Deviation is how much a particular case differs from the mean of all cases. A deviation of
zero indicates the case has the same value as the mean of all cases, a positive deviation
indicates that the case has higher value than the mean and negative deviation indicates
that the case has lower value than the mean.
The formula is d= Yi - ȳ.
The sum of deviation is always 0, because the mean is the center of all cases and cases
equally deviate positively and negatively.
If we consider the absolute value of deviation, negative values become positive. However,
the sum of absolute deviation grows larger with more cases and doesn’t allow comparisons
across samples.
The Average Absolute Deviation or ADD sums all absolute deviation and then divides it by
the total N number of cases, producing the deviation of the average case. It is very intuitive
but according to statisticians it has non-ideal properties.
The variance s2 squares the deviation to avoid the problem of negative values, summing
the squared deviation and dividing it by N-1 to get the average.
The variance is 0 if all points are exactly on the mean and it increases with the spread of
data. However, it is comparable across samples.
Another problem is the change in the measurement unit of the phenomenon, like kg to kg2.
Properties of the variance:
square: V(bX)=B2V(X)
Variance theorems
The variance of a mixture of k groups (or subpopulations), for each of which the variance
value is already known, is equal to the sum of two variances, that is,
The Z-score is the number of standard deviations that an observation falls from the mean.
The positive values are above the mean and the negative ones are below, the cases on the
mean have z=0.
It is quantified in standard deviations S.D.
It is calculated by: 𝑧 =
,-./0123(,!*4/2!
.32!5205 5/1(23(,!
Introduction to probability
Not always the knowledge of the characteristics of a phenomenon can be achieved by
observing the whole population but a sample must be extracted, via a partial survey.
Inductive or inferential statistics does not intend so much to describe what emerges from
the observed manifestations, so from the sample, but what would emerge if the survey
were extended to all the manifestations of the phenomenon. The uncertainty that derives
from the partiality of the survey is dominated by the theory of probabilities.
Events are entities characterized by randomness and are indicated by capital letters of the
Latin alphabet. The occurrence of all that is not A is indicated by 𝐴, the complementary
event to A.
The Greek letter W indicates the set of all the possible results of an experiment, a test
whose outcome is uncertain. Omega also indicates the certain event or the sample space.
When an event occurs, a probability is associated to it P(A)= -.
Formal properties of probability or Axioms of Kolmogorov
If two events cannot occur simultaneously, they are called incompatible. The probability of
their intersection is 0, or an empty space.
If two events are incompatible and we want to calculate the probability that one event or
the other will happen, the probability of their union is equal to the sum of their
probabilities P (A or B) = P(A) + P(B).
If A and B are possible outcomes, then P (A and B) = P(A) * P (B given A).
If A and B are independent events, then P (A and B) = P(A) * P(B).
Other basic rules include:
Elementary events are sets containing only one element. In general, the sample space
Omega is described in terms of elementary events.
If all elementary events are equitable, then the probability of any event is composed of
multiple elementary events.
This results in: P ( E )= # favorable cases / # possible cases.
Conditional probability
If we have two events E1 and E2 and we know the probabilities P(E1) and P(E2), we ask if
the probability of the occurrence of one varies knowing that the other one occurred.
Two events E1 and E2 will be said to be independent if the probability of the occurrence of
one remains unchanged knowing that the other occurred, i.e.
P ( E | E) = P ( E )e P ( E | E ) = P ( E).
Sampling
draw; (sampling with repetition for independent events)
(sampling without repetition, for conditional events)
Binomial coefficient
The binomial coefficient is the number of ways of picking unordered outcomes
from possibilities, also known as a combination or combinatorial number.
The value of the binomial coefficient for nonnegative and is given explicitly by
Law of total probability (supplementary)
Law of Total Probability:
If B1, B2, B3, ⋯B1, B2, B3, ⋯ is a partition of the sample space SS, then for any event AA we
have P(A)=∑iP(A∩Bi) =∑iP(A|Bi) P(Bi).
Here is a typical scenario in which we use the law of total probability. We are interested in
finding the probability of an event AA, but we don't know how to find P(A)P(A) directly.
Instead, we know the conditional probability of AA given some events BiBi, where the BiBi's
Binomial random variable
The binomial random variable X ≈ Bin ( n , p ) is a discrete variable counting the number of
successes in n Bernoullian experiments where p, 0)
%@
Among its properties:
flexes;
To figure out the shape of the distribution, if it is not normal, when can examine:
Z-Score formulas
To compare different distributions, all values can be converted in z-score, especially to use
z-score tables for normal distribution to evaluate probability distribution of a variable.
The mean of Z is 0 and the variance of Z is 1.
Sampling random variables
When we find ourselves in a situation where we can gather data on a limited number of
individuals, we can try and infer the analysis of the whole population, starting from a
sample.
A population is the entire set of persons, objects or events that have at least one common
characteristic of interest to a researcher (subject of the study), even if they present many
other different characteristics.
A sample is a subset of a population, chosen in any way, even if it mainly refers to the group
that we actually have relevant data on. However, the way in which it is chosen influences
the utility of the sample. Datasets are usually samples of a larger population.
The goal of statistical inference is to describe populations, starting from a subset of said
population to gain insight on it. In other words, it consists in making statistical
generalizations about a population from evidence contained in a sample.
It is likely to work well when a sample is large (it approaches the size of the population) and
representative rather than atypical.
It involves two tasks: using information from the sample to estimate properties of the
population and using the laws of statistics and information from the sample to determine
how close out estimate is likely to be, so the confidence in the assessment of a population.
A sample can be chosen randomly: a sample chosen from a population such that each
observation has an equal chance of being selected. Randomness ensures unbiased data, so
an atypical sample.
Biased samples can lead to false conclusions about the characteristics of a population.
population is the estimator Sample Mean 𝑋
, whose realizations are the estimates 𝑥̅ , so the
arithmetic mean of the values observed in the sample.
𝑋 =
1
𝑛
& 𝑥𝑖
!
"#$
According to probability convergence laws, the estimator sample mean gives roughly the
same result as the normal distribution of the mean, counting the standard error, which is
the standard deviation of the random variable sample mean. It represents the unit of
measurement of random error committed using the sample mean as an estimator of μ. The
standard error increases if the variance of the variable X increases in the population and
decreases if n, the number of units in the sample, grows.
Random Variable Sample Variance
If we calculate the variance of the sample extracted from the variable X, we obtain the
quantity
%
(
!
(B"
By varying the sample, we obtain a sampling variance whose expected value is NOT the true
variance
%
%
Instead, if we consider a different quantity, with (n-1) as the denominator, by varying the
sample we obtain the unbiased sample variance:
%
%
Random Variable Sample Proportion
If X is a Binomial Distribution:
The sampling proportion is 𝑝̂ =
6
!
and by varying the sample 𝑝̂ with the estimator 𝑃
C
!
we obtain estimated value and variance equal to:
%
%
Confidence Intervals
A confidence interval is the probability that a confidence interval contains our unknown
value, like the population mean 𝑃
= 1 − 𝛼. All the quantities are numbers,
even if the mean is unknown it is still a number, but P is not associated with an event.
If we rewrite it as 𝑃
= 1 − 𝛼, P is associated with an event because the
sample mean is a random variable now.
To calculate the probability associated with the event or to calculate the values a and b that
give us probability 1- 𝛼 we can exploit the distribution of the random variable sample
mean.
With 𝜎
%
known:
"*
$
, which is the same on both sides due to the symmetry of
the normal variable;
With 𝜎
%
unknown:
obtained;
distribution. It is no longer a normal distribution but a Student t distribution, with the
the horizontal axis and the value of 𝛼 on the vertical one.
For proportions, if the variable X is a Bernoullian, the sample average is in fact the
proportion of successes in the extracted sample. The estimator of an unknown sampling
proportion is in fact a Binomial.
Statistical hypothesis
If, instead of asking what is the value of a mean in a population (point estimate and
confidence interval), we have an idea of what could be the unknown value of a mean, we
check if our idea is true or false. A statistical hypothesis is an assumption about a parameter
of a distribution of a random variable. The essay of a statistical hypothesis (null hypothesis
Ho) is based on demonstration by contradiction.
The starting point is the assumption (Null hypothesis), logical arguments are made
(application of a test), if the arguments do not confirm the starting assumption (result
unlikely), then contradicts (Rejection of the Null Hypothesis).