Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

image text in transcribedimage text in transcribedimage text in transcribed
The first 6 rows of the dataset are as shown below: > head(dow) Date Close 1 1/2/28 28869 2 1/3/28 28635 3 1/6/28 28283 4 1/2/28 28584 5 1/8/28 28245 6 1/9/28 28952 Provide the simplest Fl 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 23362 29551 Using the above data, show the quartile variations for the 4 quartiles as shown below. You can use paste or sprintf. [1] \"First Quartile variation is 4823.5\" [2] \"Second Quartile variation is 1368.5" [3] \"Third Quartile variation is 4835.5\" [4] "Fourth Quartile variation is 689.5" b) Produce the output for the minimum of the Dow closing value in the dataset as shown below: [1] "The minimum Dow value of 18592 is at row 56 on 3/23/20" c) Suppose you have an index fund tied to the Dow closing value. If you have invested on the minimum date, what date from the dataset you would have sold to gain the maximum percentage gain. The output is as shown below. Note that the code should be generic so that it works on any such dataset. [1] "I would sell on 4/29/20 when Dow is at 24634 for a gain of 32.50%" d) Use the diff function to calculate the differences between consecutive closing values in the dataset. Insert the value 0 at the beginning of these differences. Add this result as the DIFFS column of the data frame. The result is as shown below. V head(dow) Date Close DIFFS 1/22'20 28869 0 1/3/23 23635 -234 1/6/26 28203 68 1/7/26 28584 -119 1/8/20 287'45 161 1/9/23 28957 212 mu'lall-LUNH e) How many days did the Dow close higher than its previous day value? How manyr days did the Dow close lower than its previous day value? [1] "44 days Dow closed higher than previous day" [1] "47 days Dow closed lower than previous day\" 1') Show the subset of the data where there was a gain of at least 1000 points from its previous day value. Date Close DIFFS 41 322220 26203 1294 43 324220 22091 11?4 4? 3210220 25018 116? 50 3213220 23186 1985 52 321?;r'20 21237 1048 5? 3224220 20205 2113 59 3226220 22552 1351 66 #6220 22600 162?r

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

Differential Equations With Boundary Value Problems

Authors: Martha L L Abell, James P Braselton

4th Edition

0124172822, 9780124172821

More Books

Students also viewed these Mathematics questions