Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

X _ 6 0 : 1 1 0 1 1 1 1 0 0 1 0 1 1 1 1 1 1 0 0 1

X_60 : 11011110010111111001110111101110111101010101
1. Write a for loop that counts the number of instances of the strings 11 and 00 in a string such as the one given above. Although it does not occur in the string above, be sure that your loop would not count strings of 11s or 00s that occur in the last two positions of the string. Verify that there are 19 instances of the string 11 and two instances of the string 00.
2. Modify your loop to include code that counts how many of the hit streaks were followed by a hit and how many of the miss streaks were followed by a hit. Verify that for the string given above, 12 of the 19 instances of the string 11 were followed by a hit and both of the instances of the string 00 were followed by a hit.
Written in R Code

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

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago