Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part1) Random Variables - 25 points Consider a game which involves rolling three dice. Write the R code for the following. Using the rollDie function

Part1) Random Variables - 25 points Consider a game which involves rolling three dice. Write the R code for the following.

Using the rollDie function from the prob library, setup the sample space for this experiment with the probability space. For each of the following scenarios from a) through e), show the corresponding outcomes and the probability of that event. The sample outputs for b) are shown as example.

a) The sum of the rolls is greater than 6 but less than 10. b) All the three rolls are identical.

b) All the three rolls are identical. Sample Output for outcomes:

x1 x2 x3 probs

1. 1 1 1 0.00463

44 2 2 2 0.00463

87 3 3 3 0.00463

130 4 4 4 0.00463

173 5 5 5 0.00463

216 6 6 6 0.00463

Sample Output for probability:

[1] 0.02778

c) Only two of the three rolls are identical. d) None of the three rolls are identical. e) Only two of the three rolls are identical given that the sum of the rolls is greater than 9.

Part4) R - 30 points

Initialize the Dow Jones Industrials daily closing data, dow, using the read.csv function with the link: http://people.bu.edu/kalathur/datasets/DJI_2020.csv

The first 6 rows of the dataset are as shown below:

> head(dow)

Date. Close

1 1/2/20 28869

2 1/3/20 28635

3 1/6/20 28703

4 1/7/20 28584

5 1/8/20 28745

6 1/9/20 28957

Provide the simplest R code and output for all of the following. The code should work for any given data.

a) Store the result of the summary function for the Close attribute as the variable sm. Change the names of this variable so that the output appears as shown below.

>sm

Min Q1 Q2 Mean Q3 Max

18592. 23466 24826 25544 28862 29551

Using the above data, show the quartile variations for the 4 quartiles as shown below. You can use paste or sprintf.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
[1] "First Quartile variation is 4873.5" [2] "Second Quartile variation is 1360.5" [3] "Third Quartile variation is 4035.5" [4] "Fourth Quartile variation is 689.5"[1] "The minimum Dow value of 18592 is at row 56 on 3/23/20""17 "I would sell on 4/29/20 when Dow is at 24634 for a gain of 32.50%"\f[1] "44 days Dow closed higher than previous day" [1] "47 days Dow closed lower than previous day"Date Close DIFFS 41 3/2/20 26703 1294 43 3/4/20 27091 1174 47 3/10/20 25018 1167 50 3/13/20 23186 1985 52 3/17/20 21237 1048 57 3/24/20 20705 2113 59 3/26/20 22552 1351 66 4/6/20 22680 1627

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Algebra And Trigonometry

Authors: Cynthia Y Young

3rd Edition

1118475755, 9781118475751

More Books

Students also viewed these Mathematics questions