Question

Date Month Day Price Volume 1 6/21/2017 6 21 99.43 32.690 2 6/22/2017 6 22 98.66...

Date Month Day Price Volume
1 6/21/2017 6 21 99.43 32.690
2 6/22/2017 6 22 98.66 54.690
3 6/23/2017 6 23 97.34 76.690
4 6/24/2017 6 24 96.67 23.690
5 6/25/2017 6 25 102.95 72.690

this file name: a

question:Find the dates which yield the highest and lowest change in price from previous day?

need to use RStudio to answer it

Homework Answers

Answer #1

You can run a loop from the first row, to the last but 1 row.

Store the highest difference date and lowest difference date in a variable.

Store the highest difference and lowest difference in other variables.

(Thus, we have 4 variables)

highest_date=''

lowest_date=''

highest_difference=0

lowest_difference=100000

for(row_number in 1:(dim(a)[1])-1){

price_difference= abs( a$Price[row_number +1] - a$Price[row_number ]

if(price_difference > highest_difference){

highest_difference= price_difference

highest_date= a$Date[row_number]

}

if(price_difference < lowest_difference){

lowest_difference= price_difference

lowest_date= a$Date[row_number]

}

}

Finally, highest_date and lowest_date contain the dates with the highest and lowest difference.

If you have any doubts related to the answer, or find an error in the code, please let me know and I will get back to you. Happy learning!

Know the answer?
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
Similar Questions
Weather Tracker Day of Month Highest Temp Weather Type 1 72 Sunny 2 67 Rain 3...
Weather Tracker Day of Month Highest Temp Weather Type 1 72 Sunny 2 67 Rain 3 62 Cloudy 4 42 Cloudy 5 40 Sunny 6 55 Rain 7 52 Cloudy 8 48 Rain 9 42 Sunny 10 44 Rain 11 52 Cloudy 12 57 Sunny 13 63 Sunny 14 65 Rain 15 74 Sunny 16 75 Sunny 17 55 Sunny 18 52 Rain 19 48 Cloudy 20 44 Rain 21 47 Sunny 22 45 Sunny 23 55 Cloudy 24 58...
21. An assumption of the cost-volume-profit analysis is: to. The unit selling price remains constant throughout...
21. An assumption of the cost-volume-profit analysis is: to. The unit selling price remains constant throughout the relevant range. b. The total fixed cost remains constant throughout the relevance interval. c. No inventory or no change in inventory quantity. d. All of the above 22. If the unit sale price is $ 50, the unit variable cost is $ 20, the total fixed cost is $ 300,000, and the tax rate is 25%, the breakeven point is: to. 6,000 units...
Month 1 2 3 4 5 6 7 Value 25 14 21 13 20 24 16...
Month 1 2 3 4 5 6 7 Value 25 14 21 13 20 24 16 (b) Develop the three-month moving average forecasts for this time series. Month Time Series Value Forecast 1 25 2 14 3 21 4 13 5 20 6 24 7 16 Compute MSE. (Round your answer to two decimal places.) MSE = What is the forecast for month 8? (c) Use α = 0.2 to compute the exponential smoothing forecasts for the time series. (Round...
Month 1 2 3 4 5 6 7 Value 24 15 21 13 19 21 16...
Month 1 2 3 4 5 6 7 Value 24 15 21 13 19 21 16 a) Develop a three-month moving average for this time series. Compute MSE and a forecast for month 8. If required, round your answers to two decimal places. Do not round intermediate calculation. MSE:_______ The forecast for month 8________ b) Use α = 0.2 to compute the exponential smoothing values for the time series. Compute MSE and a forecast for month 8. If required, round...
TABLE C6-1: Brande Properties Northwest Sleep Inn Rooms Rented in June, 2017 Date Rooms Rented 1-Jun...
TABLE C6-1: Brande Properties Northwest Sleep Inn Rooms Rented in June, 2017 Date Rooms Rented 1-Jun 30 2-Jun 36 3-Jun 49 4-Jun 48 5-Jun 27 6-Jun 29 7-Jun 29 8-Jun 34 9-Jun 37 10-Jun 51 11-Jun 59 12-Jun 49 13-Jun 37 14-Jun 40 15-Jun 44 16-Jun 47 17-Jun 59 18-Jun 62 19-Jun 50 20-Jun 41 21-Jun 46 22-Jun 40 23-Jun 50 24-Jun 58 25-Jun 64 26-Jun 60 27-Jun 57 28-Jun 51 29-Jun 43 30-Jun 47 Calculate the population mean for...
We have productivity data from 2 mills Data from Mill 1: 1, 10, 18, 21, 22,...
We have productivity data from 2 mills Data from Mill 1: 1, 10, 18, 21, 22, 22, 23, 25, 28, 29, 32, 34, 38, 40, n=13, Σx=342, Σx^2= 9836 Data from Mill 2: 13, 13, 13, 15, 18, 18, 18, 19, 19, 19, 21, 22, 22, 23, 23, 24, 27, 31, n=18, Σx=358, Σx^2= 7520 a) Calculate the mean and standard deviation for Mill 1 b) Calculate the mean and standard deviation for Mill 2 c) Assume the two are...
Day Units Inspected Units Defective 1 200 6 2 150 2 3 250 8 4 150...
Day Units Inspected Units Defective 1 200 6 2 150 2 3 250 8 4 150 0 5 200 3 6 200 4 7 250 9 8 150 1 9 250 7 10 150 2 11 100 1 12 250 6 13 200 4 14 100 0 15 250 7 16 100 1 17 200 5 18 200 3 19 250 10 20 200 4 21 200 4 22 100 0 23 250 7 24 200 4 25 100 1...
Code GEL ASX All Ordinary change% 2016/12/30 22.09 5719.1 2017/1/2 22.09 5719.1 0.00% 2017/1/3 22.51 5784.6...
Code GEL ASX All Ordinary change% 2016/12/30 22.09 5719.1 2017/1/2 22.09 5719.1 0.00% 2017/1/3 22.51 5784.6 1.15% 2017/1/4 22.32 5788.2 0.06% 2017/1/5 22.37 5805.1 0.29% 2017/1/6 22.21 5809 0.07% 2017/1/9 22.38 5857.7 0.84% 2017/1/10 22.16 5813 -0.76% 2017/1/11 22.14 5823.7 0.18% 2017/1/12 21.98 5821.6 -0.04% 2017/1/13 22.03 5776.8 -0.77% 2017/1/16 22.18 5803 0.45% 2017/1/17 22.17 5754.7 -0.83% 2017/1/18 22.24 5733.7 -0.36% 2017/1/19 22.55 5745.4 0.20% 2017/1/20 22.77 5709.7 -0.62% 2017/1/23 22.33 5668 -0.73% 2017/1/24 22.41 5706.3 0.68% 2017/1/25 22.24 5726...
Consider the following time series data. Month 1 2 3 4 5 6 7 Value 22...
Consider the following time series data. Month 1 2 3 4 5 6 7 Value 22 11 18 10 17 21 13 A) What type of pattern exists in the data? The data appear to follow a seasonal pattern. The data appear to follow a trend pattern.     The data appear to follow a horizontal pattern. The data appear to follow a cyclical pattern. B) Develop the three-month moving average forecasts for this time series. Month Time Series Value Forecast 1...
Consider the following time series data. Month 1 2 3 4 5 6 7 Value 24...
Consider the following time series data. Month 1 2 3 4 5 6 7 Value 24 13 18 12 18 23 15 b. Develop the three-month moving average forecasts for this time series. Compute MSE and a forecast for month 8 (to 2 decimals if necessary). Enter negative values as negative number. Month Time Series Value Forecast Forecast Error Squared Forecast Error 1 24 2 13 3 18 4 12 ? ? ? 5 18 ? ? ? 6 23...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT