Question

3. Youve just landed an amazing statistics internship at Marvel Comics for the summer. Since everything they create is ficti
b. Using R, find the correlation between these two vectors of data. c. In a and b, you generated 60 data points and found the
3. You've just landed an amazing statistics internship at Marvel Comics for the summer. Since everything they create is fictional, your boss has asked you to make up data. She wants a plot showing the popularity of Marvel (0 to 100 scale) vs. time since 2000 (when the movie X-Men came out). The goal is for the made-up data to follow the line y = 50 + 2.1 . (Tine since 2000). You use the below code: set.seed (12345) tvals = runif(60, 0, 19) ywals = 50 + 2.1 * tvals + rnorm(60,0,2) 2.1tvals rnorm(60,0,2) a. Explain, ords, what this code does
b. Using R, find the correlation between these two vectors of data. c. In a and b, you generated 60 data points and found the correlation. Imagine, instead, that infinitely-many points were generated. Without R, find the exact correlation using ideas seen earlier in the course. d. What number must 2 (in rnorm above) be changed to above if you want the correlation to be roughly 0.6?
0 0
Add a comment Improve this question Transcribed image text
Answer #1

a) Seed value is used to make sure that the random numbers which are generated can be reproduced.
The runif function is used to generate 60 random numbers which are nothing but time values in the range from 0 to 19 which we guess is for the year from 2000 to 2019.
yvals stores the popularity of movies and it contains the input from time values i.e. tvals which is multiplied by 2.1, there is a uniform 50 value added according to the equation( 50 +2.1) which means that every popularity value will be at least more than 50. Also rnorm function is used to generate 60 normal numbers with mean value equal to 0 and a standard deviation equal to 2 and this value is added to the rest of equation.

b) Code for finding the correlation

cor(tvals,yvals)
The correlation value is 0.9819379

c) No information about the ideas discussed in the course, so skipping this part.

d) For decreasing the correlation values between the two vectors, the standard deviation value in rnorm function should be increased. Increasing the standard deviation value in rnorm function increases the range of data in resultant vector i.e. yvals.
We uniformly increased the standard variation value in rnorm argument, the standard deviation value of 16 in rnorm function generated a correlation value near 0.6.

***New Code***

yvals= 50+ 2.1*tvals +rnorm(60,0,16)

****Output for Correlation**

cor(tvals,yvals)  
0.6157614



Add a comment
Know the answer?
Add Answer to:
3. You've just landed an amazing statistics internship at Marvel Comics for the summer. Since everything they...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT