Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Let X be a time series of 0's and 1's indicating the outcome of each trial (0 is failure, 1 is success). Write a function

Let X be a time series of 0's and 1's indicating the outcome of each trial (0 is failure, 1 is success). Write a function relative_freq(arr) where the input arr is a 1-d array of 0's and 1's. The function returns a 1-d array of the same size, of which each element is the relative frequency of success at the current time point. For example, X = [0,0,1,0,0,1,1,0,0,1] shows the result of 10 trials at time points 1,2,3,...,10. The function will find the relative frequency of success at each time point, i.e.p^=[0/1,0/2,1/3,1/4,1/5,2/6,3/7,3/8,3/9,4/10] (Hint: use cumsum.)

Write the code in Python and show output.

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions