1. Consider the function below:

f1=function(x){(3/16)*(1+((5*(x-38)^2)/80))^(-(5/2))}

(a) Is f(x) a pdf? Explain.

integrate(f1,-Inf,Inf)
## 1 with absolute error < 5.3e-05

Yes, the function is a PDF because the integral from infinity to negative infinity is equal to zero

(b) Plot f(x) between for the values of x between 26 and 46.

(c) What is the expected value of the random variable X that has f(x) as its pdf?

f1m=function(x){((3/16)*(1+((5*(x-38)^2)/80))^(-(5/2)))*x}
integrate(f1m,-Inf,Inf)
## 38 with absolute error < 0.0021

(d) What is the variance of the random variable X that has f(x) as its pdf?

f1v=function(x){((3/16)*(1+((5*(x-38)^2)/80))^(-(5/2)))*(x-38)^2}
integrate(f1v,-Inf,Inf)
## 8 with absolute error < 6.7e-05

2. Consider the step-function below :

x<-c(0,0,10,110)
y<-c(0,1/20,1/200,0)

plot(x,y,type="s") 
points(0,1/20,pch=16) 
points(110,1/200,pch=16)
points(10,1/20,pch=1) 
points(10,1/200,pch=16) 

(a) Describe a an experiment, and a random variable X based on this experiment that might have f(x) as its probability density function.

The random variable X reprisents the maximum distance people are willing to travel for food in km.

(b) What is the expected value of the random variable X that has f(x) as its pdf?

The expected value of the random variable X is 10 since the probability to either side is 0.5

(c) What is the variance of the random variable X that has f(x) as its pdf?

Unknown

3. Imagine that the number of messages arriving to a 24-server follows a Poisson distribution, where the server receives on average 30 messages each day. Let X1 = the number of messages that arrive in the 1-hour time period starting at 1:00AM.

(a) E(X1) =

1.25 calls per hour.

(b) Var(X1) =

1.25

(c) Create a plot that shows the probability distribution for the random variable X1.

set.seed(2)
x1<-table(rpois(100000,1.25))
plot((x1/100000), type = "p", col = "red",main = "X1")

Let X2 be the random variable that keeps track of the number of messages that arrive in the 1-hour period starting at 2:00AM.
set.seed(2)
x2<-table(rpois(100000,1.25))
plot((x2/100000), type = "p", col = "red",main = "X2")

(d) E(X1 + X2) =

E(x1)=1.25 and E(x2)=1.25 therefore E(x1+x2)=2.5

(e) Var(X1 + X2) =

Var(x1)=1.25 and Var(x2)=1.25 therefore Var(x1+x2)=2.5

Let A2 be the random variable that keeps track of the average number of messages per hour, based on the data from the frst two hours.
A2=(x1+x2)/2

(f) E(A2) =

E(A2)=(x1+x2)/2=E(x1+x2)/2 therefore E(A2)= 1.25

(g) Var(A2)=

Var(A2)=(x1+x2/2=E(x1+x2)/2=Var(x1+x2)/(2^2) therefore A2= 0.625

(h) Create a plot that shows the probability distribution for the random variable A2.

plot((A2/100000), type = "p", col = "red",main = "A2")

Repeat the above as follows: Let Xi = the number of messages that arrive in the 1-hour time period starting i hours after midnight. Let Ai be the random variable that keeps track of the average number of messages per hour, based on the data from the frst i hours.

(i) E(A24) =

E(A24)=(x1+…+x24)/2=E(x1+…+x24)/24 therefore E(A24)= 1.25

(j) Var(A24)=

Var(A24)=(x1+…+x24)/2=E(x1+…+x24)/24=Var(x1+x2)/(24^2) therefore Var(A24)= 0.0520833

set.seed(2);x1<-table(rpois(100000,1.25))
set.seed(5);x2<-table(rpois(100000,1.25))
set.seed(7);x3<-table(rpois(100000,1.25))
set.seed(5);x4<-table(rpois(100000,1.25))
set.seed(9);x5<-table(rpois(100000,1.25))
set.seed(11);x6<-table(rpois(100000,1.25))
set.seed(39);x7<-table(rpois(100000,1.25))
set.seed(21);x8<-table(rpois(100000,1.25))
set.seed(52);x9<-table(rpois(100000,1.25))
set.seed(49);x10<-table(rpois(100000,1.25))
set.seed(5);x11<-table(rpois(100000,1.25))
set.seed(37);x12<-table(rpois(100000,1.25))
set.seed(29);x13<-table(rpois(100000,1.25))
set.seed(21);x14<-table(rpois(100000,1.25))
set.seed(5);x15<-table(rpois(100000,1.25))
set.seed(7);x16<-table(rpois(100000,1.25))
set.seed(2);x17<-table(rpois(100000,1.25))
set.seed(10);x18<-table(rpois(100000,1.25))
set.seed(17);x19<-table(rpois(100000,1.25))
set.seed(21);x20<-table(rpois(100000,1.25))
set.seed(27);x21<-table(rpois(100000,1.25))
set.seed(31);x22<-table(rpois(100000,1.25))
set.seed(37);x23<-table(rpois(100000,1.25))
set.seed(45);x24<-table(rpois(100000,1.25))

A24=(x1+x2+x3+x4+x5+x6+x7+x8+x9+x10+x11+x12+x13+x14+x15+x16+x17+x18+x19+x20+x21+x22+x23+x24)/24
A24
## 
##            0            1            2            3            4 
## 28723.875000 35740.000000 22345.916667  9311.250000  2955.208333 
##            5            6            7            8 
##   735.875000   152.166667    31.291667     4.416667

(k) Create a plot that shows the probability distribution for the random variable A24.

plot((A24/100000), type = "p", col = "red",main = "A24")

(l) Describe what is happening to the variables Ai in a sentence or two.

As “i” increases, the plot of A in staying constant because the mean does not change from hour to hour.