What is the effect of the moving average filter

Assignment Help Other Subject
Reference no: EM132377465

Instructions:

This question asks you to plot the Bitcoin price index (BPI) along with 5-day and 10-day averages. Please execute the code cell below; it will read in a csv file containing the daily closing price from Sep. 1, 2018 to Aug. 31, 2019.

Perform the following tasks. You may use any built-in Python functions as well as data strucutres and functions provided by the numpy library.

Observe that the closing prices are at a daily interval. We therefore do not need the date information. Clean up the data and only retain the price information. Store the result in a list or a numpy array in floating point format.

Recall that a simple moving average is defined as the (unweighted) mean over the previous ??N days.

Perform a simple moving average of the price index. The number of days ??N to average over should be adjustable. If you are using numpy, you may find the function np.convolve helpful.

Plot the raw price index data along with 5-day and 10-day simple moving average. Plot on the same figure in order to help you visually ascertain the effect of the filter.

What is the effect of the moving average filter? In what circumstances would you not want to use a moving average?

Question

1. Eight athletes are competing in a 1500 m race. Using numpy , write a vectorized race simulation according to the following criteria:

The granularity of the simulation is 1 s, i.e. each iteration in your simulation represents 1 second.

During each iteration, each athelete can randomly take 1, 2, 3, or 4 steps. Each step is 1 m long.

When the race is complete, return the winner and the winning time. There should not be any ties. If there is a tie, select a winner at random.

Please pay attention to the following:

There should only be one loop in your simulation: the loop that advances the simulation by a second.

All other operations should be done using vectorized array operations and boolean indexing.

The following numpy functions will be helpful:

numpy.random.randint

numpy.sum

numpy.random.choice

2. Run your simulation 10,000 times. For each run, record the winner and the winning time. Produce a bar chart showing the number of times each athelete won. Also display a bar chart showing the average winning time for each athlete.

Here is the code to import data for the first question

Import re

def fileToList( fname, regexp=r'\W+' ):

file = open(fname, 'rt')

text = file.read()

file.close()

# split based on provided regular expression and remove empty strings

# By default, matches words.

return [x for x in re.split(regexp, text) if x]

bfile = "coindesk-bpi-close-data.csv"

bpi = fileToList( bfile, regexp=r'[,\r\n]+' )

# Print the head and tail.

print(bpi[:10:1])

print(bpi[-10::1])

Reference no: EM132377465

Questions Cloud

Discuss how this section of the constitution : Discuss how this section of the Constitution or its amendments both limit and protect business in general.
Discuss the various dimensions of transportation service : Explain the concept of total landed cost as it relates to transportation. How does it influence market boundaries? Discuss various dimensions of transportation.
Terrorists would generally prefer to attack critical targets : Terrorists would generally prefer to attack critical targets, several of which exist in nearly any city or county.
What are the ethical factors in the given situation : Identify the parties potentially affected by this audit and the fee plan proposed. What are the ethical factors in this situation? Explain.
What is the effect of the moving average filter : What is the effect of the moving average filter? In what circumstances would you not want to use a moving average? Display a bar chart showing average winning.
Evaluate issues in current environment that affect demand : Evaluate issues in the current environment that affect the demand for and supply of engineering and technical personnel. Justify specific action steps.
Why strategy is important in not- for-profit organizations : Topic - What is strategy and why is it important in business and not- for-profit organizations? What challenges do organizations face in trying to develop.
Valuable to acquire order to make a wise decision : What assumptions are there that the team can ensure the racecar approaches the starting line? What would you want to know before deciding whether to withdraw
Circuit design for more efficient TiVo-style recorder : Michael Magoo, a professional electronics design engineer, prepares a new circuit design for a more efficient TiVo-style recorder for home use.

Reviews

Write a Review

Other Subject Questions & Answers

  Cross-cultural opportunities and conflicts in canada

Short Paper on Cross-cultural Opportunities and Conflicts in Canada.

  Sociology theory questions

Sociology are very fundamental in nature. Role strain and role constraint speak about the duties and responsibilities of the roles of people in society or in a group. A short theory about Darwin and Moths is also answered.

  A book review on unfaithful angels

This review will help the reader understand the social work profession through different concepts giving the glimpse of why the social work profession might have drifted away from its original purpose of serving the poor.

  Disorder paper: schizophrenia

Schizophrenia does not really have just one single cause. It is a possibility that this disorder could be inherited but not all doctors are sure.

  Individual assignment: two models handout and rubric

Individual Assignment : Two Models Handout and Rubric,    This paper will allow you to understand and evaluate two vastly different organizational models and to effectively communicate their differences.

  Developing strategic intent for toyota

The following report includes the description about the organization, its strategies, industry analysis in which it operates and its position in the industry.

  Gasoline powered passenger vehicles

In this study, we examine how gasoline price volatility and income of the consumers impacts consumer's demand for gasoline.

  An aspect of poverty in canada

Economics thesis undergrad 4th year paper to write. it should be about 22 pages in length, literature review, economic analysis and then data or cost benefit analysis.

  Ngn customer satisfaction qos indicator for 3g services

The paper aims to highlight the global trends in countries and regions where 3G has already been introduced and propose an implementation plan to the telecom operators of developing countries.

  Prepare a power point presentation

Prepare the power point presentation for the case: Santa Fe Independent School District

  Information literacy is important in this environment

Information literacy is critically important in this contemporary environment

  Associative property of multiplication

Write a definition for associative property of multiplication.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd