Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part C, D, and E using the R Statistical Software. 4. (20 points) Let Xi be a ra

ID: 3260829 • Letter: P

Question


Part C, D, and E using the R Statistical Software.

4. (20 points) Let Xi be a random variable determined by a fair coin flip such that 1 if coin comes up heads 0 if coin comes up tails. Let Y = 1 X, and let Z( 100) = (a) (Review from 2027) What distributions (and with what parame- ters) do X, and Y come from respectively. (b) (Review from 2027) Determine the population mean and variance for X, Y, and Z(100) (c) Using R, generate 25 random samples from the distribution de- scribing Z(100) and calculate the sample mean and sample vari- ance. Generate a stem and leaf plot and a box and whisker plot for your data. (d) Using R, generate 1000 random samples from the distribution de- scribing Z(100) and calculate the sample mean and sample vari- ance (e) Using R, generate a histogram using the data from (d) where each bin (interval) has width .03. Your histogram appears like the PDF of which distribution?

Explanation / Answer

ANSWER: COPY THE FOLLOWING CODE TO YOUR R SCRIPT AS IT AS OTHERWISE IT WONT WORK.

rm(list=ls(all=TRUE))

S=c(0,1) # Sample Space
N=100 # Number of Observations

X=sample(S,N,replace=TRUE) # Random Variable X
Y=sum(X) # Random Variable Y
Z=Y/100 # Random Variable Z

# ANSWER C
# WE NEED TO GENERATE 25 RANDOM SAMPLES OF Z

Z=rep()
for(i in 1:25)
{
X=sample(S,N,replace=TRUE)
Y=sum(X)
Z[i]=Y/100
}

mean(Z) # SAMPLE MEAN OF Z
var(Z) # SAMPLE VARIANCE OF Z

stem(Z) # STEM AND LEAF PLOT OF Z
boxplot(Z,horizontal=TRUE) # BOX PLOT OF Z


# ANSWER D
# WE NEED TO GENERATE 1000 RANDOM SAMPLES OF Z

Z=rep()
for(i in 1:1000)
{
X=sample(S,N,replace=TRUE)
Y=sum(X)
Z[i]=Y/100
}

mean(Z) # SAMPLE MEAN OF Z
var(Z) # SAMPLE VARIANCE OF Z

# ANSWER E
# WE NEED TO PLOT HISTOGRAMOF Z FROM PART D

library(MASS)
truehist(Z,h=0.03)

## IT CLEARLY SHOWS THAT Z IS COMING FROM NORMAL DISTRIBUTION

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote