




























































































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!





























































































1.1 Random variables
We recall that a random variable is a variable that represents numerically a random result (of an experiment) Examples are: number of children in a household, family income, the outcome “smok- er/not smoker” The sample space is the space of all possible outcome of the observation of the random variable. For example, the household income has sample space that is a subset of the positive real line, the smoker/not smoker variable hat only two possible outcomes, that are usually coded by { 0 , 1 } (f.i., 1 =smoker) Given a sample space, events are subsets of the sample space. The probability is a measure of the possibility of a particular event E to occur. In experiments with a finite sample space, it is usually the fraction of elementary events included in the event E. For example, if you roll a die, the sample space is just the 6 faces of the die (from 1 to 6), and the event “odd number” has probability 36 = (^12) Formally, probability is a measure, defined over a space of subset of the sample space and has the following properties: (i) always between 0 and 1; (ii) the probability of the whole sample space is 1; (iii) if two events, A and B, are disjoint (meaning that they can’t occur simultaneously, then P (A ∩ B) = P (A) + P (B) Random variables can be distinguished according to the characteristics of their sample space (or, of their support):
7
Discrete Continuous
ad es. Y ∈ { 1 , 2 , ..., K} ad es. Y ∈ (−∞, ∞) PDF: F (k) = P (Y ≤ k) = P (Y = 1) + P (Y = 2) +... + P (Y = k) F (y) = P (Y ≤ y)
pmf f (k) = P (Y = k) –
pdf – f (y) ≈ P (Y = y)dy pi`u prec., f (y) = F ′(y)
Table 1.1: scheme of the definition of probability functions for discrete and continuous ran- dom variables. PDF = probability distribution function, pmf = probability mass function, pdf = probability density function.
Each random variable is completely determined by its sample space and by the proba- bility distribution defined on it (on events subsets of the sample space). Table 1.1 presents scheme of the probability functions distinguishing between discrete and continuous r.v.’s.
Examples of discrete random variables:
(n k
pk(1 − p)n−k
Examples of continuous distributions (most used in statistics):
X ∼ Tk
The skewness is the third central moment: μY 3 = E(Y − EY )^3. It can be either positive or negative. If Y is symmetric (around the mean), then μY 3 = 0. Then skewness gives information about the symmetry of the distribution.
The kurtosis is the fourth central moment: κY = E(Y − EY )^4. Sometimes divided by 3 (that is the kurtosis of a standard normal distribution). Also, the excess kurtosis is the difference κY − 3, that gives a measure of how much the kurtosis of Y is higher (or smaller) that that of a standard normal random variable. The kurtosis captures the probability mass in the tails of the distribution:
1.3 Random vectors
Let us start from two random variables X, Y. We can define the joint probability distri- bution by the function P (X ≤ x, Y ≤ y). Similarly to the random variable case, the joint probability mass function P (X = x, Y = y) = f (x, y) can be defined if both X and Y are discrete and the joint probability density function f (x, y) if both are continuous.
Given a joint distribution, the marginal distribution can be derived by the elimination of one of the two variables. The elimination is achieved by summation (if the variable is discrete) or integration (if the variable is continuous): for example PY (Y ) =
x P^ (X^ = x, Y = y) is the marginal distribution of Y , if the sum is taken over the whole support of the random variable X.
Figure 1.1: Figure from Stock and Watson’s book. Examples of distributions with diffeerent moment characteristics
The concept of joint distribution and marginalization can be extended easily to multi- variate random variables of dimensions higher than 2: the joint distribution is the function P (X 1 ≤ x 1 ,... , Xk ≤ xk), or (for continuous random variables P (X 1 = x 1 ,... , Xk = xk) and the marginal distribution of -for example- Xk, is the function
Pk(xk) =
x 1 ,...,xk− 1
P (X 1 = x 1 ,... , Xk = xk).
Given a random vector (X, Y ) we can define its conditional distribution. The condi- tional distribution of Y given X = x, is P (Y = y | X = x) = P^ (X P =(Xx,Y=x^ =) y) (if X, Y are
continuous, the definition changes into f (y | X = x) = f f^ (Xx,y (x)) ). The conditional distribution is the probability distribution of the random variable de- fined as Y | X = x (the value of Y conditional on having observed X = x). Then all conditional moments can be defined as moments with respect to the conditional probabil- ity distribution. The conditional mean:
y yP^ (Y^ =^ y^ |^ X^ =^ x) is the conditional mean. The sum is replaced by an integral if Y is continuous
The covariance measures linear dependence between two variables: X, Y can be depen- dent (strongly) but have zero covariance. The viceversa is not true: if X, Y are independent, then they must also have zero covariance.
{Covariance =0 } ⇐ independence {Covariance =0 } 6 ⇒ independence It measures the intensity of the comovement, meaning the concordance of the movement in the same direction with respect to their means. A simpler formula for the covariance: Cov(X, Y ) = EXY − μX μY.
Note that Cov(X, X) = Var(X), by definition. When the covariance is 0, we say X, Y are uncorrelated, because they have zero corre- lation. The correlation between X, Y is the “standardized” covariance:
Corr(X, Y ) = ρXY = Cov(X, Y ) √ Var(X)Var(Y )
σXY σX σY
The correlation is always between -1 and 1 by construction. This follows from a famous inequality known as Cauchy-Schwartz inequality:
Cov(X, Y )^2 ≤ Var(X)Var(Y ).
Example. To show that incorrelation does not imply independence, consider Y = X^2 , where X is a symmetric random variable with mean μX = 0. Then Cov(X, Y ) = EX ·X^2 = 0 because of symmetry, but P (X = x, Y = y) = P (X = x, Y = x^2 ) = P (X = x) if y = x^2 and P (X = x, Y = y) = 0 if y 6 = x^2. So they are not independent because P (X = x, Y = y) 6 = P (X = x)P (Y = y). The correlation is a measure alternative to the covariance:
An intermediate form of dependence is the independence in mean: Y is mean indepen- dent from X if μ(x) = E(Y | X = x) = μ does not depend on x.
Independence ⇒ Mean independence ⇒ Uncorrelation The converse is not true. Unique exception: if X, Y are Gaussian, then Independence ⇔ Mean independence ⇔ Uncorrelation
Figure 1.2: Examples of scatterplots for different values of ρ (Source: Stock and Watson)
1.5 Simple random sampling
The simple random sampling is the simplest sampling mechanism. Consists in the extrac- tion of n independent units from the same population.
The extraction is done with replacement, to allow for independence between the ex- tracted values (mathematically modeled by random variables).
First of all, since the sample mean is used to estimate the true, unknown population mean, what would we like mean and variance to be like: (i) The mean of Y¯ should be at least very close to μY , meaning that if we could repeat the sampling, averaging out all estimates obtained we would have a correct value; (ii) We want the estimator to be reliable: in most cases we can’t repeat the sampling, so we need to trust that the observed value of the estimator ¯y is not too far from its mean (and so, from its true value). The first point is related to the concept of unbiasedness of the estimator: an estimator θˆ = T (Y 1 ,... , Yn) for a parameter θ is unbiased if ET = θ. The sample mean is then an unbiased estimator for μ if E Y¯ = μY. The second point is related to the variance of the estimator: we want the estimator to have a low variance, so that it is concentrated around its mean, that coincides with the true value (if the estimator is unbiased). So, we compute mean and variance of the sample mean, that is, the mean and variance of the random variable Y¯. Under simple random sampling:
E Y¯ = En−^1
∑^ n
i=
Yi = n−^1
i
EYi = n−^1
∑^ n
i=
μY = μY
Note that we only used identical distribution (same mean for all Yi) but not inde- pendence
Var( Y¯ ) = Var
n−^1
∑^ n
i=
Yi
= (by independence) = n−^2
i
V ar(Yi) = n−^1 σ^2 Y
Here independence is necessary to use the property Var(
i Yi) =^
i Var(Yi). The second property tells us that the variance of the sample mean depends on the variance of the population (the higher the dispersion of the distribution from which we draw our data the lower the reliability of the estimate), and on the sample size (more data implieas more information impleas higher precision of the estimate). This guarantees that, if the sample size is large enough (and the population variance is not infinite), the variance of the estimator becomes arbitrarily low, guaranteeing that the distance between the estimate and the and the population mean is small with increasingly high probability.
Consistency The last concept is formalized by the definition of consistency of an esti- mator: an estimator ˆθ = T (Y 1 ,... , Yn) for a parameter θ is consistent if with probability (converging to) one, the distance θˆ − θ < δ, for any arbitrary δ > 0. It is a property so-called asymptotic, because it involves the behavour of the estimator as the sample size increases (to infinity). Intuitively: if we could observe the whole (infinite) population,
there should be no estimation error and the estimator should concentrate it distribution into the true value. From the expression of the variance, and the fact that E Y¯ = μY , it is evident that
( Y¯ − μy) → 0with probability 1
so, the sample mean is consistent.
MSE. The difference M SE(θˆ) = E(T (Y 1 ,... , Yn) − θ)^2 = E(θˆ − θ)^2 is the squared mean of the difference between the estimator and the true parameter, and it is called mean squared error. If T is an unbiased estimator, then M SE(T ) = Var(T ), because θ = ET (Y 1 ,... , Yn) = E(θˆ). In general, however, there is the decomposition:
M SE(θˆ) = Var(θˆ) + (E(θˆ) − θ)^2
the second term in the right hand side is the square of the bias of θˆ.
Efficiency At a fixed sample size, we could have two estimators for the mean, both un- biased, both consistent. Which one is better? We compare the MSE. The estimator with smallest MSE for our sample size is more efficient. In (rare) cases, there are estimators that can be proved to be the most efficient within a particular class of estimators. The sample mean is one example. The sample mean is BLUE (best linear unbiased estimator), that is the estimator that has the lowest variance among all estimators unbiased for the mean and that can be written as a linear combination of the units (namely, in the form T (Y 1 ,... , Yn) =
i ciYi, for some weights ci)
Asymptotic normality A very useful property of the sample mean, and of many other estimators that can be written as a sum of random variables, it that its sampling distri- bution can be approximated with a Gaussian normal distribution. The precision of the approximation increases with the sample size. In formulas, √ n( Y¯ − μY ) ≈ N (0, σ^2 Y )
where ≈ means that the random variable
n( Y¯ − μY ) is not actually distributed as a N (0, σ Y^2 ) for finite n (that would be written as ∼ N (0, σ Y^2 )), but, if the sample size is large, the approximation can be used as if it was the true sampling distribution. Note that we should write
n( Y¯ − μY ), highlighting the fact that the statistic Y¯ = Y¯n depends on n, because it is proportional to the sum of the n observations of the variable Y , and, because of that, its sampling distribution also depends on n. This result is a consequence of the famous central limit theorem (CLT).
1.8 Sample variance
One of the most important statistics, is the sample variance:
s^2 Y =
n − 1
∑^ n
i=
(Yi − Y¯ )^2.
The statistic s^2 Y is an estimator for the variance of the population distribution of the variable Y.
Es^2 Y =
n − 1
i
E(Yi − Y¯ )^2 =
n − 1
i
E(Yi − μY + μY − Y¯ )^2 =
n − 1
i
E(Yi − μY )^2 +
n − 1
i
E( Y¯ − μY )^2 − 2
i
n − 1
E(Yi − μY )( Y¯ − μY )
n − 1
nσ Y^2 +
n − 1
n σ Y^2 n
n − 1
i
Yi − nμY )( Y¯ − μY )
n + 1 n − 1
σ^2 Y − 2 n n − 1
i
Yi n
− μY )( Y¯ − μY )
n + 1 n − 1 σ^2 Y − 2
n n − 1 E( Y¯ − μY )^2
= n + 1 n − 1
σ^2 Y −
n − 1
σ Y^2 = σ^2 Y
We call SY the standard deviation The statistic SY /
n is an estimator of the standard error of Y¯ (SE( Y¯ ) = σ/
n),
1.9 Confidence intervals
A confidence interval for μY : a (random) interval that contains the parameter μY with a pre-determined probability, called confidence level 1 − α (usually, 0.95 or 0.99). If the variance of Y , σ^2 Y , is known: [ (^) ¯ Y ± z 1 −α/ 2 SE( Y¯ )
Y ± z 1 −α/ 2 σ/
n
If the variance of Y is not known, but it is estimated by s^2 Y : [ Y¯ ± tn− 1 , 1 −α/ 2 ̂SE( Y¯ )
Y ± tn− 1 , 1 −α/ 2 SY /
n
The construction of the confidence interval relies on the asymptotic normal approxima- tion for X¯. Ex. n = 200, Y¯ = 22.64$, SY = 18.14, t 199 , 0. 975 ≈ 1 .96,
IC = [20.13; 25.15]
Because of the asymptotic Gaussian approximation (and because of the fact that the higher n the more a Student-t r.v. with n − 1 degrees of freedom is similar to a standardized Gaussian, you can replace the quantiles of the Student distribution with the normal if n is large: [ Y¯ ± z 1 −α/ 2 SÊ ( Y¯ )
Y ± z 1 −α/ 2 SY /
n
A similar reasoning can be applied to any parameter. A confidence interval for an arbitrary scalar parameter θ, for which we have an asymptotically normal estimator θˆ,
with estimated standard error SÊ (θˆ), the confidence interval at level 1 − α is:
[ θˆ ± z 1 −α/ 2 ̂SE(θˆ)
= [θˆ − z 1 −α/ 2 SÊ (θˆ); θˆ + z 1 −α/ 2 ̂ SE(θˆ)].
1.10 Tests on the mean
We want to test whether a certain hypothesis on the population mean is true or not (is the average income lower than a certain level? Is the percentage of students who have mathematical skills below or above the European average?...), using evidence from the data. The test paradigma is composed of the null hypothesis (H 0 ) and the alternative (H 1 ), the is what we assume is true if the null is rejected (true unless verified otherwise).
Possible states Decision H 0 H 1
Acceptance H 0 1 − α β [Confidence] Type I error probability
Rejection H 0 α 1 − β Type I error probability Power of the test Significance of the test
Suppose we want to test the simple hypothesis μY = μ 0. We can have different altena- tives: H 1 : μY > μ 0 , H 1 : μY < μ 0 (two one-sided alternatives), H 1 : μY 6 = μ 0 , two sided alternative. If the variance σ^2 Y is unknown but estimated by s^2 Y :