Suppose the winnings of gamblers at Las Vegas are normally distributed with mean \$670 and standard deviation \$38. Generate 10000 random numbers using rnorm function. Show how this distribution would look like. Add in the plot the mean, median and 20\% trimmed mean (provide these values). In the previous problem, how much someone has to win to be in the top 5%? Solve using R studio.
Answer:
Now,we have the winnings of gamblers at Las Vegas are normally distributed with mean $670 and standard deviation $38.
#####
mu<-670
sigma<-38
### Generate 10000 random numbers from given normal distibution
i.e N(670,38)
x<-rnorm(10000,670,38)
## Plot histogram for checking distribution of generated data
mean<-mean(x)
669.7082
median<-median(x)
669.4677
trim_mean<-mean(x,trim=0.2)
669.6669
hist(x,xlab = "Class",ylab = "Frequency",main = "Histogram of
X",col="chocolate3")
## ad mean on histogram
abline(v = mean,
col = "royalblue",
lwd = 2)
## ad median on histogram
abline(v = median,
col = "red",
lwd = 2)
## ad trimed mean on histogram
abline(v = trim_mean,
col = "yellow",
lwd = 2)
Get Answers For Free
Most questions answered within 1 hours.