Sta 141a fall 2016 homework markov chain write a function


Q1. Markov chain: Write a function to generate a sequence of random variables {Xi}ni=1 taking values 0 and 1, following the probability model

P(Xi+1 = l|Xi = k) = πkl       k, l = 0, 1;

where 0 < πkl < 1, and π00 + π01 = 1 and π10 + π11 = 1.

Q2. Write a function that takes a sequence (vector) of 0 or 1 as input and returns the starting locations of runs of 0's and runs of 1's, where the length of a run is set to an integer K ≥ 1.

Q3. Write a function that takes a sequence (vector) of 0 or 1 as input and returns the starting location of all subsequences that start and end with prespecified motifs (vectors of 0's and 1's).

Q4. Generate sequences of length 10000 from the Markov chain described in Problem 1, by using two different transition probability matrices:

1054_Figure.png

For each of the cases (a) and (b), compute the following:

(i) Starting location of runs of 0's and 1's of lengths up to 10. What is a good representation of this data? Do you see any difference in patterns between runs of 0's and runs of 1's?

(ii) Starting locations of all subsequences of length 200 that start and end with the motifs 0000 and 1111, respectively.

(iii) Perform a descriptive statistical analysis to compare your results in cases (a) and (b). Write a brief report summarizing you findings.

Q5. Give an informative graphical statistical summary of the following datasets (available with base R). In each case, write very brief (maximum of 80 words) description highlighting the findings.

(i) AirPassengers : Monthly airline passenger numbers during 1949-1960.

(ii) EuStockMarkets : Daily closing prices of major European stock indices during 1991-1998.

(iii) PlantGrowth : Results from a controlled experiment on plant growth.

(iv) trees : Girth, weight and volume for Black Cherry trees.

(v) airquality : Data on New York air quality measurements.

Request for Solution File

Ask an Expert for Answer!!
Applied Statistics: Sta 141a fall 2016 homework markov chain write a function
Reference No:- TGS01643976

Expected delivery within 24 Hours