In: Statistics and Probability
Exercise 4 (Indicator variables). Let (Ω, P) be a probability space and let E ⊆ Ω be an event. The indicator variable of the event E, which is denoted by 1E , is the RV such that 1E (ω) = 1 if ω ∈ E and 1E(ω)=0ifω∈Ec.Showthat1E isaBernoullivariablewithsuccessprobabilityp=P(E).
Exercise 5 (Variance as minimum MSE). Let X be a RV. Let xˆ ∈ R be a number, which we consider as a ‘guess’ (or ‘estimator’ in Statistics) of X . Let E[(X − xˆ)2] be the mean squared error (MSE) of this estimation.
(i) Showthat
E[(X −xˆ)2]=E[X2]−2xˆE[X]+xˆ2 (2) =(xˆ−E[X])2 +E[X2]−E[X]2 (3) =(xˆ−E[X])2 +Var(X). (4)
(ii) ConcludethattheMSEisminimizedwhenxˆ=E[X]andtheglobalminimumisVar(X).Inthis sense, E[X ] is the ‘best guess’ for X and Var(X ) is the corresponding MSE.
Exercise 6. Suppose we have the following sample of Google’s stock price for the past 50 weeks (unit in $ per stock).
320 326 325 318 322 320 329 317 316 331 320 320 317 329 316 308 321 319 322 335 318 313 327 314 329 323 327 323 324 314 308 305 328 330 322 310 324 314 312 318 313 320 324 311 317 325 328 319 310 324
(i) Compute the sample mean x ̄ and sample standard deviation
x.
(ii) Draw the ordered stem-and-leaf display. How many sample values
are between x ̄ ± s, and
x ̄±2s?
(iii) Give the five-number summary of the sample. Draw the
corresponding box plot.
The R-code useful for all calculations are provided as below:
x=c(320,326,325,318,322,320,329,317,316,331,320,320,317,329,316,308,321,319,322,335,318,313,327,314,329,323,327,323,324,314,308,305,328,330,322,310,324,314,312,318,313,320,324,311,317,325,328,319,310,324)
sort(x)
length(x)
xbar=mean(x);xbar
x_sqbar=mean(x^2);x_sqbar
var=x_sqbar-(xbar)^2;var
sd=sqrt(var);sd
l1=xbar-sd;u1=xbar+sd
l2=xbar-(2*sd);u2=xbar+(2*sd)
l1;u1;l2;u2
count1=0;count2=0
for(i in 1:length(x))
{
count1[i]=ifelse(l1<=x[i] && x[i]<=u1,1,0)
count2[i]=ifelse(l2<=x[i] && x[i]<=u2,1,0)
}
sum(count1)
sum(count2)
quantile(x)
boxplot(x)