Docsity
Top Seller

Statistics, con formulario - IPLE, Appunti di Statistica

Anteprima parziale del testo

Scarica Statistics, con formulario - IPLE e più Appunti in PDF di Statistica solo su Docsity!

Statistics

Professor Silvia Salini

A.Y. 2021/

DESCRIPTIVE STATISTICS

Measurements and Datasets

  • To measure to gather information that characterizes or represents a social phenomenon.

Before starting to measure, one must determine the unit of analysis, which is the type of thing which

one is trying to collect information about.

There are three main types of measurement scales:

Þ Nominal scales assign labels to different cases. They must be:

o Homogeneous → All people in a given category must have a commonality.

o Mutually exclusive → People must not fit into more than one category.

o Exhaustive → There should always be a category for everybody, even if it is “other”.

Þ Ordinal scales are similar to nominal scales, but other than just listing the groups, they are

also ordered. They must be:

o Homogeneous → All people in a given category must have a commonality.

o Mutually exclusive → People must not fit into more than one category.

o Ordered → All the possible answers can be ranked.

Ordinal scales are distinct from nominal scales because they can meaningfully be ordered,

however they do not specify the distance between categories.

Þ Interval or ratio scales must be:

o Homogeneous → All people in a given category must have a commonality.

o Ordered → All the possible answers can be ranked.

o Measured in comparable units.

Interval or ratio scales may be:

o Continuous → Can be measured with infinite precision.

o Discrete → Can only take on specific values (e.g. integers).

Different statistical techniques are used to analyze each type of variable: a common error is to apply

a tool made for an interval measure to a nominal variable, resulting in incorrect conclusion. In order

to avoid this kind of mistakes, a statistician needs to think carefully about what is being measured

and how to accurately measure it.

  • Suppose that a unit of analysis and a measurement strategy have been chosen and that

measurements on relevant cases have already been taken. The acquired sets of measurements need to

be organized in a spreadsheet, where rows contain all measurements on each case and columns reflect

sets of variables.

  • An issue arises when the variables to be dealt with have an infinite possible number of values,

as in this scenario cases rarely have the exact same value.

The solution to this problem is to use grouped data: sets of similar values must be grouped together

by constant intervals, graphically resulting in a histogram.

The height of each bar represents the number of cases within a given range of values

  • Example:

a. Marital status b. Number of children c. Weight in Kg

When classes are not of the same range, density is needed to calculate the mode. As pictured above,

density is equal to the cases pertaining to a given category over the width of the class they pertain to.

Common Terminology

Validity → The degree to which a measurement captures what it is intended to.

Reliability → The extent to which a measure produces consistent results.

If validity and reliability are poor, measurements become meaningless.

Histograms appear different

depending on how wide

intervals are set.

Sample survey → To interview a sample of people from a population where $ = sample size.

Finite population → Population of inference (PI); Target population (PO); Frame population (PC);

Survey population (PE).

Experiment → To compare responses of subjects under different conditions with matters assigned to

the conditions.

Randomization and Sampling

  • Randomization is the mechanism for achieving reliable data by reducing potential bias.

Random sampling can be implemented by using random number tables or with statistical software

that generate random numbers.

o Simple random sample → In a simple survey, each possible sample of size $ has the same

chance of being selected.

This is an example of a probability sampling method, where the probability of any

particular sample being selected can be specified. Other probability sampling methods are

systematic, stratified, and cluster sampling.

o Sampling frame → Listing of all subjects in the population. It must exist in order to

implement simple random sampling.

For nonprobability sampling, probabilities of the possible samples cannot be specified, making them

highly unreliable.

  • Whereas sample surveys are examples of observational studies (they merely observe subjects

without any manipulation), experimental studies involve researchers assigning subjects to

experimental conditions. In this case, subjects should be assigned at random to the treatments because

randomization balances treatment groups with respect to other variables that could affect response.

  • The sampling error of a statistic is the error that occurs when a sample statistic is used to

predict the value of a population parameter. Randomization protects against bias, with sampling error

tending to fluctuate around 0 with predictable size.

Other factors besides sampling error that can cause results to vary from sample to sample are sampling

bias (nonprobability sampling), response bias (poorly worded questions), and nonresponse bias

(undercoverage or missing data).

Central Tendency Indexes: Mode, Median, Percentiles, Mean

  • A measure of central tendency is important to assess the typical value of a variable.
  • The mode – or modal value – of a variable is the value representing the largest number of

cases. It is useful for nominal, ordinal, and numerical variables. In the case of continuous variables,

it is useful only if data is grouped into a histogram.

N

)

J

O

?AG

HIJ

K

H

Þ To calculate the first quartile use the formula

P

M

($ + 1 ). If the data is grouped use

N

P

)

Q

O

?AG

HIJ

K

H

Upper and lower bound of quantiles are useful reference points that describe data: the border of the

nd

and 3

rd

quartile is the median, and the border of the top quartile gives a sense of how many cases

distinguish the upper end of the distribution from the lower end. Graphically, boxplots are charts

where the lower line is the first quartile, the middle line represents the median, and the upper line is

the upper quartile. The two wings represent the lowest and the highest values, the circles represent

outliers, and the star represents three times the percentile.

In boxplots the R

ST

percentile is the R% of observations below it, meaning that ( 100 − R)% are above

it:

Þ R = 50 → Median.

Þ R = 25 → Lower quartile (XN).

Þ R = 75 → Upper quartile (ZN).

Þ Interquartile range → [N\ = ZN − XN.

Outliers are observations falling below XN − 1. 5 ([N) and ZN + 1. 5 ([N).

  • The mean – or average – is calculated by adding the values of all cases, then dividing the total

number of cases. As opposed to the other measures of central tendency, it operates on categories

rather than on frequency. It is useful for continuous measures and it is not overly-influenced by any

single peak, however it can be influenced by extreme values.

Each case can be identified as a subscript, where ^ )

represents the - ith case of the variable ^, 1 goes

from 1 to L, ^

is the value of ^ for the first case, ^

@

is the value of ^ for the second case, and ^

G

is

the value for the last case. The formula to calculate the mean is ^ =

G

∑ ^

)

G

)`#

Þ If we consider a dataset, the arithmetic mean is given by the simple arithmetic mean formula

a

?

)

?

)`#

Þ If we consider a frequency table, the arithmetic mean is given by the weighted arithmetic

mean formula " =

a

?

)

)

b

)`#

. For the variables grouped in classes, the central values

are considered.

For symmetric distributions, the mean and the median are equal. However, for skewed distributions

the mean is dragged in the direction of the longer tail relative to the median.

The mean has four properties:

Þ The arithmetic mean of a variable is always included between the minimum value and the

maximum value assumed by the variable itself, that is "

c)?

cef

Þ The average of a constant is equal to the constant itself. Furthermore, if a variable " is

multiplied by a constant, its average is also multiplied by the same constant, that is

= + gh

= = + g&(h) where = and g are constants and & is the mean operator.

Multiplying the mean by = + gh is the same as adding = plus g times the mean of h.

Þ The algebraic sum of the deviations of the "

)

values from their arithmetic mean is equal to

zero:

)

)

?

)`#

?

)`#

If you calculate the distance of each variable from the mean and then sum them all together,

the result will be 0.

Þ The sum of squares of the deviations of "

)

values from their arithmetic mean is minimal (least

squares property):

)

@

?

)`#

The two theorems of the mean are:

Þ The arithmetic mean of k subgroups (of k subpopulation), for each of each of which is already

known the value of the arithmetic mean, is equal to the weighted arithmetic mean of the

average of the individual groups: " =

?

)i

?

)

)

b

)`#

?

H

i`#

b

)`#

Þ 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: if j = h + ^, then &

j

&(h + ^) = &(h) + &(^) =

?

)

c

∑ k

i

c

i`#

?

)`#

Other Univariate Stats: Skewness

  • Skewness refers to the symmetry of a distribution:

Þ When the tail is on the left → Negative skew.

Þ When the tail is on the right → Positive skew.

Þ Perfectly symmetrical distributions → No skew.

N.B. the side of the distribution with the tail is the one with the fewer cases.

Skewness provides information about the inequality present in the data, so it may reflect floor or

ceiling effects. Often, it is merely used descriptively, but statisticians have created a measure where

0 = perfectly symmetrical and anything above 0 = increasing skew; this measure is based on the

distance between the mean and the median because the mean moves towards extreme cases, which is

exactly what the tail does. The formula to calculate it is l5Dm =

P(nAco?)

p q

Global Variability

  • Interquartile range [N\ = N

P

− N

  • Range w = " cef

c)?

, where the minimum is the lowest value a variable assumes in the

dataset, and the maximum is the highest value a variable assumes in the dataset.

Measures of Dispersion

-

Variance and Standard Deviation

  • Deviation measures how much each particular cases differs from the mean of all cases.

Þ Deviation of zero indicates that the case has the same value as the mean.

Þ Positive deviation → Case has a higher value than the mean.

Þ Negative deviation → The cases has a lower value than the mean.

The deviation is calculated with the formula 8 = ^ )

− ^ and it represents the distance from the mean.

  • To understand how to turn deviation into a useful measure of dispersion, we will analyze

different ideas:

  1. Add up all the deviations of all cases ∑ 8

)

G

)`#

→ Problem! The sum of the deviation is always

zero, as the mean is the exact center of all cases and the cases equally deviate positively and

negatively. This means that dispersion cannot be measured in this way.

  1. To solve the problem of step #1, we could sum up the absolute value of the deviation

)

G

)`#

→ Problem! The sum of absolute deviation grows larger as the number of cases

increases, therefore this measure does not allow comparison across samples.

  1. To solve the problem of step #2, we could calculate the average absolute deviation by dividing

absolute deviation by the total cases, obtaining the deviation of the average case

∑ |o

H

|



HÄJ

G

Here, we use the mean to determine the typical size of deviations: instead of using it to analyze

typical case values, we use it to analyze what sort of deviation is typical.

  1. In order to avoid the issue of negative values and in order not to lose any informativeness of

the values through the use of absolute values, we can square the deviation and divide by L −

1 to get the average Å

n

@

∑ o

H

 F

HÄJ

GA#

∑ Çn

H

AnÉ

F



HÄJ

GA#

→ Result: the variance. The variance:

Þ Is zero if all points cluster exactly on the mean.

Þ Increases the further points lie from the mean.

Þ Is comparable across samples of different size.

However, the disadvantage of the variance is that values get large due to its squaring.

  1. In order to avoid the issue of large numbers, we take the square root of the variance in order

to shrink it back downÅ

n

= ÑÅ

n

@

Ö

∑ Çn

H

AnÉ

F



HÄJ

GA#

→ Result: the standard deviation.

  • The properties of the variance are:

Þ The variance of a constant is 0 → Ü

Þ It is invariant for translation, meaning that if at each "

)

a constant quantity is added, the

variance does not change → Ü

h + =

= Å

f

@

Þ If every "

)

is multiplied by a constant g, the variance is multiplied by the constant g in square

→ Ü

gh

= g

@

Ü

h

If these three properties are combined together we get Ü

= + gh

= g

@

l

f

@

  • The variance has two theorems:

Þ The variance of a mixture of k groups, for each of which the variance value is already known,

is equal to the sum of two variances, that is:

Þ The variance of the sum (or difference) of two variables is equal to the sum of variances of

the individual variables only if they are independent. In fact, j = h + ^:

o If h and ^ are independent Ü(j) = Ü(h + ^) = Ü(h) + Ü(^).

o If h and ^ are correlated Ü

j

= Ü

h + ^

= Ü

h

+ Ü
^
  • 2 áàÜ(h, ^).

INTRODUCTION TO PROBABILITY

  • What is the link between the statistical tools we have dealt with this far and the study of real

phenomena? Often, the knowledge of the characteristics of a phenomenon can be achieved only

through the study of a sample extracted from the whole population.

The goal of inductive (or inferential) statistics is not to describe what emerges from the observed

manifestations, but to understand what would emerge if a given survey was to be extended to all the

manifestations of the phenomenon. The uncertainty that derives from the partiality of the survey it is

dominated by the theory of probabilities.

  • When an event occurs, a probability is associated with it. Formal properties of probability are:

Þ Probability is never a negative number.

Þ Probability 0 is assigned to events that are not expected to occur (almost impossible events)

and probability 1 is assigned to events that are expected to occur (almost certain events).

Þ The sample space of every event is contained in Ω such that 0 < >

å

)

This means that (å

)

Þ If two events å

and å

@

cannot occur simultaneously (their intersection coincides with the

empty set), they are incompatible: å

∩ å

@

å

∩ å

@

Þ To calculate the probability that both the event å

and the event å

@

occur (å

∪ å

@

) and the

two events are incompatible, then the probability of the union is equal to the sum of the

probabilities: >(å

∪ å

@

) = >(å

) + >(å

@

It is possible to summarize all these properties in the axioms of Kolmogorov. Some other rules are:

Þ å ∪ å = Ω, so >(å) + >ÇåÉ = 1 and >(å) = 1 − >ÇåÉ.

Þ If å

∩ å

@

= ∅, then >

å

∪ å

@

å

å

@

å

∩ å

@

  • Elementary events are sets containing only one element. In general, the sample space is

described in terms of elementary events: Ω =

í

, í

@

, … , í

?

Terminology

Events → Entities characterized by randomness; things that can occur or not.

o Events are indicated with capital letters of the Latin alphabet (å

o The occurrence of all that is not å is indicated with å and is called a complementary event

to å.

o Ω indicates the set of all the possible results of an experiment. It is also called sample space.

Experiment → A test whose outcome is uncertain.

If the elementary events are all equitable, that is >({í

}) = >({í

@

}) = ⋯ = >({í

?

}), then the

probability of any event is composed of multiple elementary events >

å

îeïyzeñKó òeôóô

öyôô)ñKó òeôóô

Þ Conditional probability → If we have two events å

and å

@

of probabilities >(å

) and >(å

@

the probability of the occurrence of one varies knowing that the other occurred: >(å

|å

@

õ(ú

J

∩ú

F

)

õ(ú

F

)

Þ Independent events → Two events å

and å

@

are said to be independent if the probability of

the occurrence of one remains unchanged knowing that the other occurred. To check if two

events are independent use the formula >

å

∩ å

@

= >(å

) × >(å

@

Example: In a deck of 40 cards, å

is the event of extracting harts and its probability is >(å

#û

Mû

å @

is the event of extracting an ace, and its probability is >(å

@

M

Mû

. Does the probability of

extracting a hart change if you know that the card that has been drawn is an ace?

å

å

@

å

∩ å

@

å

@

>(=üD 'r ℎD=°¢)

>(=üD)

>(å

∩ å

@

) = >(å

) × >(å

@

×
  • The De Morgan laws explain that the complementation operation exchanges the union

operator with the intersection operator and vice versa: å

∩ å

@

= å

∪ å

@

and å

∪ å

@

= å

∩ å

@

Sampling

  • Suppose you draw a ball from an urn:

Þ Extraction with replacement → The probability of extraction of a single ball remains constant

in each draw.

Þ Extraction without replacement → The probability of extraction of a single ball changes.

This concept, transliterated in a statistical language, means that assuming to extract a unit from a

population:

Þ Sampling with repetition → Independent events.

Þ Sampling without repetition → Conditional events.

Binomial Coefficient

  • How many different ways can I extract (without replacement) 5 elements from a set of $

elements? In other words, how many combinations of $ things can be taken 5 at a time without

repetition?

INTRODUCTION TO RANDOM VARIABLES

Random Variables

  • A random variable is a real function defined on an event space, so a function that associates a

real number with elements of the space of events Ω.

Þ Discrete random variable → The random variable h is said to be discrete if it assumes a finite

number or a finite number of values "

@

b

The function that associates to the values "

@

b

their respective probabilities >(h =

)

), 1 = 1 , … , 5 is called probability distribution and it is such that

>(h = "

)

b

)`#

Þ A continuous random variable is a function that can assume all values within a range (=, g).

The function {", r(")} with r(∙) ≥ 0 is said density function and is such that >(h ≤ ") =

r(Æ) 8Æ

f

AØ

and ∫

r(Æ) 8Æ

f

AØ

= 1 , where >(h ≤ ") represents the area under the curve r(∙)

to the point ", that is, the cumulative distribution function.

For continuous random variables >

h = "

= 0 , the possible cases are infinite and therefore

h = "

)

îeïyzeñKó òeôóô

öyôô)ñKó òeôóô

Ø

  • The Bernoullian experiment is a random experiment consisting of a set of $ repeated tests

with the following characteristics:

Þ At every single test there are only two possible outcomes: ‘success’ and ‘failure’.

Þ The probability R of ‘success’ is constant.

Þ The trials are independent.

If $ = 1 → Bernoulli random variable

A discrete random variable assuming only 2 values, namely 0 and 1, with probabilities respectively

( 1 − R) and R with 0 < R < 1 is said Bernoulli random variable: h ≈ ±D°(R). Its properties are:

Þ >(h = 1 ) = R

Þ >(h = 0 ) = 1 − R, with 0 < R < 1

Þ å(h) = R

Þ Ü(h) = R( 1 − R)

If $ > 1 → Binomial random variable

The discrete random variables counting the number of success in $ Bernoullian experiments R, 0 <

R < 1 , is the probability of success in the single replication is called the binomial random variable

h ≈ ±1$($, R). The binomial distribution can assume all integer values from 0 to $ according to the

following probability: >

h = "

= Ç

?

f

ÉR

f

1 − R

?Af

with " = 0 , 1 , … , $. Its properties are:

Þ å(h) = $R

Þ Ü(h) = $R( 1 − R)

  • The Gaussian or Normal random variable is a continuous random variable that assumes all

real numbers, and is defined by the density function r

≥√@μ

D

A

(∂I∑)

F

F∏

F

. Its properties are:

Þ It is symmetrical with respect to " = a. The mean, mode, and median coincide with a.

Þ It assumes that the maximum value for " = a.

Þ It is asymptotic with respect to the abscissa axis.

Þ It has two flexes at points "

= a − π and "

@

= a + π.

The normal distribution is also used to calculate the kurtosis and the skew:

  • If an experiment is replicated infinite times, the resulting distribution will be the normal one.

Population and Sample Notation

  • Whereas characteristics of populations are called parameters, characteristics of a sample are

called statistics. To keep things straight, mathematicians use Greek letters to refer to populations and

Roman letters to refer to samples:

Þ ^ → Mean of a sample.

Þ a → Mean of the population.

Þ l → Standard deviation of a sample.

Þ π → Standard deviation of the population.

  • Estimates of a population parameter based on information from a sample is called a point

estimate. Formulas to estimate a population parameter from a sample are estimators.

Mathematicians identify estimates of population parameters in formulas by placing a caret ^ over the

parameter.

  • π and a are constants → There is

one true value, but it is unknown.

  • l and ^ are variables → There are

many possible samples, thus many

possible values for each.

The range of possible values makes up a

distribution: the sampling distribution.

Sample Random Variables

Þ A parameter of a random variable h, generally indicated by ª, is a function of values that the

random variable assumes for the whole population and characterizes the distribution of the

random variable itself.

Þ The estimate ¢ is a function of sample data used to predict the unknown value of a parameter

ª of a random variable h, which is the object of the study in the population reference.

Þ The estimator º

?

is the random variable generated by the estimates calculated on all samples

of Ω

?

  • Estimators have three properties:

Þ Unbiasedness → An estimator is called unbiased of its expected value coincides with the

parameter being estimated. å(º

?

Þ Consistency → If an estimator is unbiased and if $ increases its variance tends to 0, i.e.

lim

?→Ø

Ü=°(º

?

) = 0 , then the estimator º

?

is called consistent.

Þ Relative efficiency → An unbiased estimator º

?#

is more efficient than a second unbiased

estimator º

?@

if its variance is smaller: Ü=°(º

?#

) < Ü=°(º

?@)

Sample Mean

  • The statistics that estimate the mean of a population a in the best way is the estimator sample

mean h, whose realizations are the estimates of ".

Probability convergence laws (law of the large numbers and central limit theorem) show that

h~L(a,

≥

F

?

  • Standard error 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 estimator of a.

åÅÇhÉ =

π

åÅÇhÉ

?→Ø

ø⎯⎯¡ 0

Standard error increases if the variance of the variable h in the population increases and decreases if

$ increases.

Sample Variance

  • If we calculate the variance of the sample ("

?

) extracted from the variable h we obtain

the quantity l

@

?

)

@

?

)`#

. By varying the sample we obtain a sampling variance whose

expected value is not the true variance å

Å

@

?A#

?

π

@

  • Instead, if we consider the quantity l

@

?A#

)

? @

)`#

, by varying the sample we obtain

the unbiased sample å

Å

@

= π

@

Sample Proportion

  • In a binomial distribution h where the expected value is å

h

= $R; the variance is Ü=°

h

$R( 1 − R); and the sampling proportion is R̂ =

f

?

, if the sample R̂ is varied to describe the estimator

ƒ

?

, then å

Ç
É

?

å

h

?

$R = R and Ü•\

Ç
É

?

F

Ü•\

h

?

F

$R

ö

( ?A#

)

?