Question

In: Statistics and Probability

Programming in R: Some days Zach finds that he has nothing better to do than sit...

Programming in R:

Some days Zach finds that he has nothing better to do than sit on a porch and watch cars pass him by. On average, he sees about 15 cars pass in a single day. Simulate an entire year of Zach’s car-watching pastime (assume every month is 30 days long), compute the mean for each month, and generate a histogram of the means. Does the distribution of the means look normal? Why or why not?

Solutions

Expert Solution

According to the question,Here Zach is watches 15 cars per day,And the next day he is watching 15+15cars i.e 30 cars per second day.So Here it is increasing day by day.So we will find it by using the Exponential distribution Using R studio.

First we will create a dat frame and we will do as follows the script,

Watching_count<-data.frame("Days"=c(1:360),"avarage_cars"=15*c(1:360))

Watching_count$month<-ifelse(Watching_count$Days<=30,1,

ifelse(Watching_count$Days>30 & Watching_count$Days<=60,2,

ifelse(Watching_count$Days>60 & Watching_count$Days<=90,3,

ifelse(Watching_count$Days>90 & Watching_count$Days<=120,4,

ifelse(Watching_count$Days>120 & Watching_count$Days<=150,5,

ifelse(Watching_count$Days>150 & Watching_count$Days<=180,6,

ifelse(Watching_count$Days>180 & Watching_count$Days<=210,7,

ifelse(Watching_count$Days>210 & Watching_count$Days<=240,8,

ifelse(Watching_count$Days>240 & Watching_count$Days<=270,9,

ifelse(Watching_count$Days>270 & Watching_count$Days<=300,10,

ifelse(Watching_count$Days>300 & Watching_count$Days<=330,11,12 )))))))))))

library(sqldf)

aggre_by_month<-sqldf("select month,sum(avarage_cars)/30 as mean_of_month  from Watching_count group by month")

library(stats)

plot(aggre_by_month$mean_of_month,type = "h", xlab="month",ylab="mean_of_month")

Histogram:

In these image,We are showing Monthy wise Mean is calculated here,.According to these dataframe,We are prepared Histogram.

Now we are checking the normality test of means

In R,We are testing the shapiro-wilk normality test,

shapiro.test(aggre_cate_by_month$mean_of_month),

By these test,we are getting P-value=0.87,

p-value is greater than 0.05,implying that the distribution of the mean's are not significantly different from normal distribution.In other words we can assuem that data is normally distributed.


Related Solutions

Once a company has decided to “do something different” (rather than “do nothing” or “do nothing...
Once a company has decided to “do something different” (rather than “do nothing” or “do nothing differently”), what kinds of changes can they make?
A researcher finds that, up to a point, the more anxiety one has, the better he...
A researcher finds that, up to a point, the more anxiety one has, the better he or she will perform in a job interview. However, at some point, if one has too much anxiety, his or her performance will suffer. What type of relationship does this represent negative curvilinear positive no correlation
Zach has been appointed fiscal coordinator for the stanford narcolepsy institute. He has the task of...
Zach has been appointed fiscal coordinator for the stanford narcolepsy institute. He has the task of valuing 3M. 3M will pay a dividend of $2.25 next quarter. Zach estimates that the firm will grow at 6% per quarter for 4 years, at 3% per quarter for 3 years, then at 1% per quarter thereafter. The cost of equity is 16% with annual compounding. Find the correct stock price for 3M.
R programming a. obtain the dataset ChickWeight b. obtain the mean weight at 16 days for...
R programming a. obtain the dataset ChickWeight b. obtain the mean weight at 16 days for all chicks on that diet
A certain weightlifter is prone to back injury. He finds that he has a 20% chance...
A certain weightlifter is prone to back injury. He finds that he has a 20% chance of hurting his back if he uses the proper form of bending at the hips and keeping his spine locked. The probability that he will hurt his back with bad form is 95%. The probability that he uses proper form is 75%. A. What is the probability that he doesn't hurt his back and has proper form? B. What is the probability he doesn't...
A certain weightlifter is prone to back injury. He finds that he has a 20% chance...
A certain weightlifter is prone to back injury. He finds that he has a 20% chance of hurting his back if he uses the proper form of bending at the hips and keeping his spine locked. The probability that he will hurt his back with bad form is 95%. The probability that he uses proper form is 75%. A. What is the probability that he hurts his back and has proper form? B. What is the probability that he doesn't...
Zach, a 20-year-old, adopts sublimation as a defense mechanism. He has a keen interest in poetry....
Zach, a 20-year-old, adopts sublimation as a defense mechanism. He has a keen interest in poetry. He wants to pursue a career in theater as he loves acting. In the context of Freud’s psychosexual stages of personality development, he is most likely to be fixated at the: a) oral stage. b) anal stage. c) phallic stage. d) latent stage.
a.Why are some networks better than others to change the world in the direction of the...
a.Why are some networks better than others to change the world in the direction of the collective preferences of their members? b. Briefly identify and discuss the ten factors that impact emergence and effectiveness of global networks
FILL IN THE BLANK: (The size of the blank has nothing to do with the answer)...
FILL IN THE BLANK: (The size of the blank has nothing to do with the answer) 1. The _____ propensity to consume is the change in _____ from a one unit increase in aggregate income or output 2. When a country has a stabilization________ it will use Keynesian fiscal stimulus whenever real GDP was expected to fall short of the full ___________ output level. 3. The _________ out effect occurs when government borrowing leads to higher _________ rates and lower...
R programming What is the probability that someone needs to ask more than 12 people to...
R programming What is the probability that someone needs to ask more than 12 people to successfully get directions from 5? Your answer should be 3.21%. Show the code that leads to this result, and explain why.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT